{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://itworx.local/pulse/specs/metric-definition.schema.json", "title": "Semantic metric definition", "type": "object", "additionalProperties": false, "required": [ "semanticName", "version", "description", "unit", "valueKind", "sourceKind", "queryTemplate", "allowedLabels", "cardinalityBudget", "limits", "allowedVisualizations", "freshnessSeconds" ], "properties": { "semanticName": { "type": "string", "pattern": "^[a-z][a-z0-9]*(\\.[a-z][a-z0-9_]*)+$", "maxLength": 160 }, "version": { "type": "integer", "minimum": 1 }, "description": { "type": "string", "minLength": 1, "maxLength": 1000 }, "unit": { "type": "string", "maxLength": 40 }, "valueKind": { "type": "string", "enum": [ "gauge", "counter", "state", "histogram" ] }, "sourceKind": { "type": "string", "enum": [ "prometheus", "inventory", "event", "derived" ] }, "queryTemplate": { "type": "string", "minLength": 1, "maxLength": 4000 }, "requiredCapabilities": { "type": "array", "maxItems": 20, "items": { "type": "string", "maxLength": 100 } }, "allowedLabels": { "type": "array", "maxItems": 30, "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$" } }, "defaultAggregation": { "type": "string", "enum": [ "none", "avg", "sum", "min", "max", "rate", "increase", "p50", "p95", "p99" ] }, "cardinalityBudget": { "type": "integer", "minimum": 1, "maximum": 10000 }, "limits": { "type": "object", "additionalProperties": false, "required": [ "maxRangeSeconds", "maxSeries", "maxPoints", "timeoutSeconds" ], "properties": { "maxRangeSeconds": { "type": "integer", "minimum": 60 }, "maxSeries": { "type": "integer", "minimum": 1, "maximum": 10000 }, "maxPoints": { "type": "integer", "minimum": 10, "maximum": 1000000 }, "timeoutSeconds": { "type": "integer", "minimum": 1, "maximum": 120 } } }, "allowedVisualizations": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "enum": [ "stat", "timeseries", "gauge", "ranked-list", "status-grid", "table", "heatmap", "storage-map", "topology", "service-matrix" ] } }, "freshnessSeconds": { "type": "integer", "minimum": 1 }, "defaultThresholds": { "type": "array", "maxItems": 10, "items": { "type": "object", "additionalProperties": false, "required": [ "state", "operator", "value" ], "properties": { "state": { "type": "string", "enum": [ "attention", "degraded", "critical" ] }, "operator": { "type": "string", "enum": [ ">", ">=", "<", "<=", "==", "!=" ] }, "value": { "type": "number" }, "durationSeconds": { "type": "integer", "minimum": 0 } } } } } }