-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert(schemas): use local schema validation for rules API (#18)
* revert(schemas): use local schema validation for rules API Signed-off-by: hayk96 <hayko5999@gmail.com> * Update CHANGELOG.md Signed-off-by: hayk96 <hayko5999@gmail.com> --------- Signed-off-by: hayk96 <hayko5999@gmail.com>
- Loading branch information
Showing
6 changed files
with
144 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://json.schemastore.org/prometheus.rules.json", | ||
"additionalProperties": false, | ||
"definitions": { | ||
"duration": { | ||
"type": ["string", "null"], | ||
"pattern": "^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$", | ||
"minLength": 1 | ||
}, | ||
"label_name": { | ||
"type": "string", | ||
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$" | ||
}, | ||
"label_value": { | ||
"type": "string" | ||
}, | ||
"labels": { | ||
"type": ["object", "null"], | ||
"patternProperties": { | ||
"^[a-zA-Z_][a-zA-Z0-9_]*$": { | ||
"$ref": "#/definitions/label_value" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"tmpl_string": { | ||
"description": "A string which is template-expanded before usage.", | ||
"type": "string" | ||
}, | ||
"annotations": { | ||
"type": ["object", "null"], | ||
"patternProperties": { | ||
"^[a-zA-Z_][a-zA-Z0-9_]*$": { | ||
"$ref": "#/definitions/tmpl_string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"recording_rule": { | ||
"type": "object", | ||
"properties": { | ||
"record": { | ||
"description": "The name of the time series to output to. Must be a valid metric name.", | ||
"type": "string" | ||
}, | ||
"expr": { | ||
"description": "The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and the result recorded as a new set of time series with the metric name as given by 'record'.", | ||
"type": "string" | ||
}, | ||
"labels": { | ||
"$ref": "#/definitions/labels", | ||
"description": "Labels to add or overwrite before storing the result." | ||
} | ||
}, | ||
"required": ["record", "expr"], | ||
"additionalProperties": false | ||
}, | ||
"alerting_rule": { | ||
"type": "object", | ||
"properties": { | ||
"alert": { | ||
"description": "The name of the alert. Must be a valid metric name.", | ||
"type": "string" | ||
}, | ||
"expr": { | ||
"description": "The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts.", | ||
"type": "string" | ||
}, | ||
"for": { | ||
"$ref": "#/definitions/duration", | ||
"description": "Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending." | ||
}, | ||
"keep_firing_for": { | ||
"$ref": "#/definitions/duration", | ||
"description": "How long an alert will continue firing after the condition that triggered it has cleared." | ||
}, | ||
"labels": { | ||
"$ref": "#/definitions/labels", | ||
"description": "Labels to add or overwrite for each alert." | ||
}, | ||
"annotations": { | ||
"$ref": "#/definitions/annotations", | ||
"description": "Annotations to add to each alert." | ||
} | ||
}, | ||
"required": ["alert", "expr"], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"description": "Prometheus rules file", | ||
"properties": { | ||
"groups": { | ||
"type": ["array", "null"], | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"description": "The name of the group. Must be unique within a file.", | ||
"type": "string" | ||
}, | ||
"interval": { | ||
"$ref": "#/definitions/duration", | ||
"description": "How often rules in the group are evaluated." | ||
}, | ||
"limit": { | ||
"description": "Limit the number of alerts an alerting rule and series a recording rule can produce. 0 is no limit.", | ||
"type": ["integer", "null"], | ||
"default": 0 | ||
}, | ||
"rules": { | ||
"type": ["array", "null"], | ||
"items": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/recording_rule" | ||
}, | ||
{ | ||
"$ref": "#/definitions/alerting_rule" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"required": ["name"], | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"title": "Prometheus Rules", | ||
"type": ["object", "null"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.