{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instana/json-schema/instana-mobile-app-alert-config-schema.json",
  "title": "MobileAppAlertConfig",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instana-event-settings-api-openapi.yml#/components/schemas/MobileAppAlertConfig",
  "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."
    },
    "completeTagFilterExpression": {
      "$ref": "#/$defs/TagFilterExpression"
    },
    "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 mobile app alert configuration. Used as a template for the description of alert/event notifications triggered by this Smart Alert configuration.",
      "maxLength": 65536,
      "minLength": 0
    },
    "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
      ]
    },
    "mobileAppId": {
      "type": "string",
      "description": "ID of the mobile app that this Smart Alert configuration is applied to.",
      "maxLength": 64,
      "minLength": 0
    },
    "name": {
      "type": "string",
      "description": "Name of the mobile app alert configuration. Used as a template for the title of alert/event notifications triggered by this Smart Alert configuration.",
      "maxLength": 256,
      "minLength": 0
    },
    "rule": {
      "$ref": "#/$defs/MobileAppAlertRule"
    },
    "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/RuleWithThresholdMobileAppAlertRule"
      },
      "maxItems": 1,
      "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).",
      "maximum": 10,
      "minimum": 5
    },
    "tagFilterExpression": {
      "$ref": "#/$defs/TagFilterExpressionElement"
    },
    "threshold": {
      "$ref": "#/$defs/Threshold"
    },
    "timeThreshold": {
      "$ref": "#/$defs/MobileAppTimeThreshold"
    },
    "triggering": {
      "type": "boolean",
      "description": "Optional flag to indicate whether an Incident is also triggered or not."
    }
  },
  "required": [
    "customPayloadFields",
    "description",
    "granularity",
    "mobileAppId",
    "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"
      ]
    },
    "MobileAppAlertRule": {
      "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"
        },
        "metricName": {
          "type": "string"
        }
      },
      "required": [
        "alertType",
        "metricName"
      ]
    },
    "MobileAppTimeThreshold": {
      "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"
      ]
    },
    "RuleWithThresholdMobileAppAlertRule": {
      "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/MobileAppAlertRule"
        },
        "thresholdOperator": {
          "type": "string",
          "enum": [
            ">",
            ">=",
            "<",
            "<="
          ]
        },
        "thresholds": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ThresholdConfigRule"
          }
        }
      },
      "required": [
        "rule",
        "thresholdOperator",
        "thresholds"
      ]
    },
    "TagFilterExpression": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/TagFilterExpressionElement"
        },
        {
          "type": "object",
          "properties": {
            "elements": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/TagFilterExpressionElement"
              }
            },
            "logicalOperator": {
              "type": "string",
              "description": "Set AND / OR",
              "enum": [
                "AND",
                "OR"
              ]
            }
          }
        }
      ],
      "required": [
        "elements",
        "logicalOperator"
      ]
    },
    "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"
      ]
    }
  }
}