{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instana/json-schema/instana-get-infrastructure-groups-query-schema.json",
  "title": "GetInfrastructureGroupsQuery",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instana-infrastructure-analyze-api-openapi.yml#/components/schemas/GetInfrastructureGroupsQuery",
  "type": "object",
  "properties": {
    "groupBy": {
      "type": "array",
      "description": "Entity grouping tag. Use the Instana Analyze Infrastructure dashboard to determine the entity grouping tag name.",
      "items": {
        "type": "string",
        "description": "Entity grouping tag. Use the Instana Analyze Infrastructure dashboard to determine the entity grouping tag name."
      },
      "maxItems": 5,
      "minItems": 0
    },
    "metrics": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InfraMetricConfiguration"
      },
      "maxItems": 10,
      "minItems": 0
    },
    "missingPlaceholder": {
      "type": "string"
    },
    "order": {
      "$ref": "#/$defs/Order"
    },
    "pagination": {
      "$ref": "#/$defs/CursorPaginationInfraExploreCursor"
    },
    "tagFilterExpression": {
      "$ref": "#/$defs/TagFilterExpressionElement"
    },
    "timeFrame": {
      "$ref": "#/$defs/TimeFrame"
    },
    "type": {
      "type": "string",
      "description": "Type of entities"
    }
  },
  "required": [
    "groupBy",
    "pagination",
    "tagFilterExpression",
    "timeFrame"
  ],
  "$defs": {
    "ArithmeticConfiguration": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/InfraMetricConfiguration"
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "$ref": "#/$defs/ArithmeticOperation"
            }
          }
        }
      ]
    },
    "ArithmeticOperand": {
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/SingleValue"
        },
        {
          "$ref": "#/$defs/MetricQuery"
        },
        {
          "$ref": "#/$defs/NestedOperation"
        }
      ]
    },
    "ArithmeticOperation": {
      "type": "object",
      "properties": {
        "left": {
          "$ref": "#/$defs/ArithmeticOperand"
        },
        "operator": {
          "type": "string"
        },
        "right": {
          "$ref": "#/$defs/ArithmeticOperand"
        }
      },
      "required": [
        "left",
        "operator",
        "right"
      ]
    },
    "CursorPaginationInfraExploreCursor": {
      "type": "object",
      "properties": {
        "cursor": {
          "$ref": "#/$defs/InfraExploreCursor"
        },
        "retrievalSize": {
          "type": "integer",
          "format": "int32",
          "description": "number of values to return"
        }
      },
      "required": [
        "retrievalSize"
      ]
    },
    "InfraExploreCursor": {
      "type": "object",
      "description": "cursor to use between successive queries"
    },
    "InfraMetricConfiguration": {
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/SimpleMetricConfiguration"
        },
        {
          "$ref": "#/$defs/ArithmeticConfiguration"
        }
      ]
    },
    "MetricQuery": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ArithmeticOperand"
        },
        {
          "type": "object",
          "properties": {
            "aggregation": {
              "type": "string",
              "enum": [
                "SUM",
                "MEAN",
                "MAX",
                "MIN",
                "P25",
                "P50",
                "P75",
                "P90",
                "P95",
                "P98",
                "P99",
                "P99_9",
                "P99_99",
                "DISTINCT_COUNT",
                "SUM_POSITIVE",
                "PER_SECOND",
                "INCREASE"
              ],
              "writeOnly": true
            },
            "crossSeriesAggregation": {
              "type": "string",
              "enum": [
                "SUM",
                "MEAN",
                "MAX",
                "MIN",
                "P25",
                "P50",
                "P75",
                "P90",
                "P95",
                "P98",
                "P99",
                "P99_9",
                "P99_99",
                "DISTINCT_COUNT",
                "SUM_POSITIVE",
                "PER_SECOND",
                "INCREASE"
              ],
              "writeOnly": true
            },
            "granularity": {
              "type": "integer",
              "format": "int64",
              "writeOnly": true
            },
            "metric": {
              "type": "string",
              "writeOnly": true
            },
            "regex": {
              "type": "boolean",
              "writeOnly": true
            },
            "required": {
              "type": "boolean",
              "writeOnly": true
            }
          }
        }
      ]
    },
    "NestedOperation": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ArithmeticOperand"
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "$ref": "#/$defs/ArithmeticOperation"
            }
          }
        }
      ]
    },
    "Order": {
      "type": "object",
      "description": "Specifies the ordering of the results.\nIt contains fields that define the sorting criteria, the collation for sorting, and the direction in which the results should be ordered.\n",
      "properties": {
        "by": {
          "type": "string",
          "description": "If the granularity is set to `1` you can use the metric name eg. `latency.p95` to order by that value."
        },
        "collation": {
          "type": "string",
          "description": "Language code used for sorting. Ignored for infrastructure queries."
        },
        "direction": {
          "type": "string",
          "description": "The order in which results will be sorted, either `ASC` for ascending or `DESC` for descending.",
          "enum": [
            "ASC",
            "DESC"
          ]
        }
      },
      "required": [
        "by",
        "direction"
      ]
    },
    "SimpleMetricConfiguration": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/InfraMetricConfiguration"
        },
        {
          "type": "object",
          "properties": {
            "aggregation": {
              "type": "string",
              "enum": [
                "SUM",
                "MEAN",
                "MAX",
                "MIN",
                "P25",
                "P50",
                "P75",
                "P90",
                "P95",
                "P98",
                "P99",
                "P99_9",
                "P99_99",
                "DISTINCT_COUNT",
                "SUM_POSITIVE",
                "PER_SECOND",
                "INCREASE"
              ]
            },
            "crossSeriesAggregation": {
              "type": "string",
              "enum": [
                "SUM",
                "MEAN",
                "MAX",
                "MIN",
                "P25",
                "P50",
                "P75",
                "P90",
                "P95",
                "P98",
                "P99",
                "P99_9",
                "P99_99",
                "DISTINCT_COUNT",
                "SUM_POSITIVE",
                "PER_SECOND",
                "INCREASE"
              ]
            },
            "granularity": {
              "type": "integer",
              "format": "int64",
              "description": "   * If granularity is not specified an aggregated value for the selected timeframe is returned.\n   * If granularity is specified data points are returned with the specified granularity\n    * The granularity should not be greater than the `windowSize` (important: `windowSize` is expressed in milliseconds)\n    * The granularity should not be set too small relative to the `windowSize` to avoid creating an excessively large number of data points (max 600)\n",
              "title": "granularity in milliseconds"
            },
            "metric": {
              "type": "string"
            },
            "regex": {
              "type": "boolean"
            },
            "required": {
              "type": "boolean",
              "description": "When true, metric must be present with values"
            }
          }
        }
      ],
      "required": [
        "aggregation",
        "metric"
      ]
    },
    "SingleValue": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ArithmeticOperand"
        },
        {
          "type": "object",
          "properties": {
            "value": {
              "type": "number",
              "format": "double"
            }
          }
        }
      ]
    },
    "TagFilterExpressionElement": {
      "type": "object",
      "description": "Boolean expression of tag filters to define the scope of relevant calls.",
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "TimeFrame": {
      "type": "object",
      "description": "Time range for which the data should be retrieved.",
      "properties": {
        "to": {
          "type": "integer",
          "format": "int64",
          "description": "end of timeframe expressed as the Unix epoch time in milliseconds. Eg: `ISO 8601` standard time `2024-06-27T05:05:55.615Z` can be represented as `1719464755615` in Unix epoch time in milliseconds."
        },
        "windowSize": {
          "type": "integer",
          "format": "int64",
          "description": "windowSize in milliseconds",
          "maximum": 2678400000,
          "minimum": 0
        }
      }
    }
  }
}