{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instana/json-schema/instana-infra-alert-config-with-metadata-schema.json",
  "title": "InfraAlertConfigWithMetadata",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instana-infrastructure-alert-configuration-api-openapi.yml#/components/schemas/InfraAlertConfigWithMetadata",
  "type": "object",
  "properties": {
    "alertChannelIds": {
      "type": "array",
      "deprecated": true,
      "description": "List of IDs of alert channels defined in Instana. Can be left empty.",
      "items": {
        "type": "string",
        "deprecated": true,
        "description": "List of IDs of alert channels defined in Instana. Can be left empty."
      },
      "maxItems": 1024,
      "minItems": 0,
      "uniqueItems": true
    },
    "alertChannels": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "description": "Set of alert channel IDs associated with the severity.",
        "items": {
          "type": "string",
          "description": "Set of alert channel IDs associated with the severity."
        },
        "uniqueItems": true
      },
      "description": "Set of alert channel IDs associated with the severity."
    },
    "created": {
      "type": "integer",
      "format": "int64",
      "minimum": 1
    },
    "customPayloadFields": {
      "type": "array",
      "description": "Custom payload fields to send additional information in the alert notifications. Can be left empty.",
      "items": {
        "$ref": "#/$defs/CustomPayloadField"
      },
      "maxItems": 20,
      "minItems": 0
    },
    "description": {
      "type": "string",
      "description": "Description of the Infrastructure Smart Alert. Used as a template for the description of alert/event notifications triggered by this Smart Alert configuration.",
      "maxLength": 65536,
      "minLength": 0
    },
    "enabled": {
      "type": "boolean"
    },
    "evaluationType": {
      "type": "string",
      "description": "Determines whether we evaluate each infra entity independently or group of entities will be evaluated together.",
      "enum": [
        "PER_ENTITY",
        "CUSTOM"
      ]
    },
    "gracePeriod": {
      "type": "integer",
      "format": "int64",
      "description": "The duration for which an alert remains open after conditions are no longer violated, with the alert auto-closing once the grace period expires."
    },
    "granularity": {
      "type": "integer",
      "format": "int32",
      "default": 600000,
      "description": "The evaluation granularity used for detection of violations of the defined threshold. Defines the size of the tumbling window used.",
      "enum": [
        60000,
        300000,
        600000,
        900000,
        1200000,
        1800000
      ]
    },
    "groupBy": {
      "type": "array",
      "description": "The grouping tags used to group the metric results.",
      "items": {
        "type": "string",
        "description": "The grouping tags used to group the metric results."
      },
      "maxItems": 5,
      "minItems": 0
    },
    "id": {
      "type": "string",
      "maxLength": 64,
      "minLength": 0
    },
    "initialCreated": {
      "type": "integer",
      "format": "int64",
      "minimum": 1
    },
    "name": {
      "type": "string",
      "description": "Name of the Infrastructure Smart Alert. Used as a template for the title of alert/event notifications triggered by this Smart Alert configuration.",
      "maxLength": 256,
      "minLength": 0
    },
    "readOnly": {
      "type": "boolean"
    },
    "rule": {
      "$ref": "#/$defs/InfraAlertRule"
    },
    "rules": {
      "type": "array",
      "description": "A list of rules where each rule is associated with multiple thresholds and their corresponding severity levels. This enables more complex alert configurations with validations to ensure consistent and logical threshold-severity combinations.",
      "items": {
        "$ref": "#/$defs/RuleWithThresholdInfraAlertRule"
      },
      "maxItems": 5,
      "minItems": 1
    },
    "severity": {
      "type": "integer",
      "format": "int32",
      "deprecated": true,
      "description": "The severity of the alert when triggered, which is either 5 (Warning), or 10 (Critical)."
    },
    "tagFilterExpression": {
      "$ref": "#/$defs/TagFilterExpressionElement"
    },
    "threshold": {
      "$ref": "#/$defs/Threshold"
    },
    "timeThreshold": {
      "$ref": "#/$defs/InfraTimeThreshold"
    },
    "triggering": {
      "type": "boolean",
      "description": "Optional flag to indicate whether an Incident is also triggered or not."
    }
  },
  "required": [
    "customPayloadFields",
    "description",
    "granularity",
    "groupBy",
    "id",
    "name",
    "tagFilterExpression",
    "timeThreshold"
  ],
  "$defs": {
    "CustomPayloadField": {
      "type": "object",
      "description": "Custom payload fields to send additional information in the alert notifications. Can be left empty.",
      "properties": {
        "key": {
          "type": "string",
          "description": "A user-specified unique identifier or name for a custom payload entry."
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "key",
        "type"
      ]
    },
    "InfraAlertRule": {
      "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"
          ]
        },
        "alertType": {
          "type": "string"
        },
        "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"
          ]
        },
        "entityType": {
          "type": "string"
        },
        "metricGroupBy": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "metricName": {
          "type": "string"
        },
        "metricTagFilterExpression": {
          "$ref": "#/$defs/TagFilterExpressionElement"
        },
        "regex": {
          "type": "boolean"
        }
      },
      "required": [
        "alertType",
        "metricName"
      ]
    },
    "InfraTimeThreshold": {
      "type": "object",
      "description": "The type of threshold to define the criteria when the event and alert triggers and resolves.",
      "properties": {
        "timeWindow": {
          "type": "integer",
          "format": "int64"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "RuleWithThresholdInfraAlertRule": {
      "type": "object",
      "description": "A list of rules where each rule is associated with multiple thresholds and their corresponding severity levels. This enables more complex alert configurations with validations to ensure consistent and logical threshold-severity combinations.",
      "properties": {
        "rule": {
          "$ref": "#/$defs/InfraAlertRule"
        },
        "thresholdOperator": {
          "type": "string",
          "enum": [
            ">",
            ">=",
            "<",
            "<="
          ]
        },
        "thresholds": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ThresholdConfigRule"
          }
        }
      },
      "required": [
        "rule",
        "thresholdOperator",
        "thresholds"
      ]
    },
    "TagFilterExpressionElement": {
      "type": "object",
      "description": "Boolean expression of tag filters to define the scope of relevant calls.",
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "Threshold": {
      "type": "object",
      "deprecated": true,
      "description": "Indicates the type of threshold this alert rule is evaluated on.",
      "properties": {
        "operator": {
          "type": "string",
          "enum": [
            ">",
            ">=",
            "<",
            "<="
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "operator",
        "type"
      ]
    },
    "ThresholdConfigRule": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    }
  }
}