Alerting: Rule version history API (#99041)
* implement store method to read rule versions * implement request handler * declare a new endpoint * fix fake to return correct response * add tests * add integration tests * rename history to versions * apply diff from swagger CI step Signed-off-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com> --------- Signed-off-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
@@ -1343,6 +1343,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ruler/grafana/api/v1/rule/{RuleUID}/versions": {
|
||||
"get": {
|
||||
"description": "Get rule versions by UID",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RouteGetRuleVersionsByUID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "RuleUID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "GettableRuleVersions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GettableRuleVersions"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "ForbiddenError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ForbiddenError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": " Not found."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ruler/grafana/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "List rule groups",
|
||||
@@ -4088,7 +4125,9 @@
|
||||
"description": "adapted from cortex",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"uid",
|
||||
"name",
|
||||
"folderUid",
|
||||
"query",
|
||||
"health",
|
||||
"type",
|
||||
@@ -4118,6 +4157,9 @@
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"folderUid": {
|
||||
"type": "string"
|
||||
},
|
||||
"health": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -4157,6 +4199,9 @@
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -4818,6 +4863,14 @@
|
||||
"CounterResetHint": {
|
||||
"$ref": "#/definitions/CounterResetHint"
|
||||
},
|
||||
"CustomValues": {
|
||||
"description": "Holds the custom (usually upper) bounds for bucket definitions, otherwise nil.\nThis slice is interned, to be treated as immutable and copied by reference.\nThese numbers should be strictly increasing. This field is only used when the\nschema is for custom buckets, and the ZeroThreshold, ZeroCount, NegativeSpans\nand NegativeBuckets fields are not used in that case.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
},
|
||||
"PositiveBuckets": {
|
||||
"description": "Observation counts in buckets. Each represents an absolute count and\nmust be zero or positive.",
|
||||
"type": "array",
|
||||
@@ -4834,7 +4887,7 @@
|
||||
}
|
||||
},
|
||||
"Schema": {
|
||||
"description": "Currently valid schema numbers are -4 \u003c= n \u003c= 8. They are all for\nbase-2 bucket schemas, where 1 is a bucket boundary in each case, and\nthen each power of two is divided into 2^n logarithmic buckets. Or\nin other words, each bucket boundary is the previous boundary times\n2^(2^-n).",
|
||||
"description": "Currently valid schema numbers are -4 \u003c= n \u003c= 8 for exponential buckets.\nThey are all for base-2 bucket schemas, where 1 is a bucket boundary in\neach case, and then each power of two is divided into 2^n logarithmic buckets.\nOr in other words, each bucket boundary is the previous boundary times\n2^(2^-n). Another valid schema number is -53 for custom buckets, defined by\nthe CustomValues field.",
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
@@ -5279,6 +5332,9 @@
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updated_by": {
|
||||
"$ref": "#/definitions/UserInfo"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
@@ -5362,6 +5418,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"GettableRuleVersions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/GettableExtendedRuleNode"
|
||||
}
|
||||
},
|
||||
"GettableStatus": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -7220,7 +7282,9 @@
|
||||
"description": "adapted from cortex",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"uid",
|
||||
"name",
|
||||
"folderUid",
|
||||
"query",
|
||||
"health",
|
||||
"type"
|
||||
@@ -7230,6 +7294,9 @@
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"folderUid": {
|
||||
"type": "string"
|
||||
},
|
||||
"health": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -7251,6 +7318,9 @@
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -7283,6 +7353,7 @@
|
||||
"required": [
|
||||
"name",
|
||||
"file",
|
||||
"folderUid",
|
||||
"rules",
|
||||
"interval"
|
||||
],
|
||||
@@ -7294,6 +7365,9 @@
|
||||
"file": {
|
||||
"type": "string"
|
||||
},
|
||||
"folderUid": {
|
||||
"type": "string"
|
||||
},
|
||||
"interval": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
@@ -7419,6 +7493,10 @@
|
||||
"description": "Sample is a single sample belonging to a metric. It represents either a float\nsample or a histogram sample. If H is nil, it is a float sample. Otherwise,\nit is a histogram sample.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"DropName": {
|
||||
"description": "DropName is used to indicate whether the __name__ label should be dropped\nas part of the query evaluation.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"F": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
@@ -8097,6 +8175,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"UserInfo": {
|
||||
"type": "object",
|
||||
"title": "UserInfo represents user-related information, including a unique identifier and a name.",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Userinfo": {
|
||||
"description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a [URL]. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.",
|
||||
"type": "object"
|
||||
@@ -8298,6 +8388,7 @@
|
||||
}
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
@@ -8459,6 +8550,7 @@
|
||||
}
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
@@ -8583,6 +8675,7 @@
|
||||
}
|
||||
},
|
||||
"gettableSilences": {
|
||||
"description": "GettableSilences gettable silences",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
|
||||
Reference in New Issue
Block a user