Alerting: Remove id and org_id from grafana alert rule API model (#100139)

This commit is contained in:
Yuri Tseretyan 2025-02-05 16:13:22 -05:00 committed by GitHub
parent 0fe4b15d00
commit f7d476e408
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 0 additions and 75 deletions

View File

@ -585,8 +585,6 @@ func toGettableExtendedRuleNode(r ngmodels.AlertRule, provenanceRecords map[stri
gettableExtendedRuleNode := apimodels.GettableExtendedRuleNode{ gettableExtendedRuleNode := apimodels.GettableExtendedRuleNode{
GrafanaManagedAlert: &apimodels.GettableGrafanaRule{ GrafanaManagedAlert: &apimodels.GettableGrafanaRule{
ID: r.ID,
OrgID: r.OrgID,
Title: r.Title, Title: r.Title,
Condition: r.Condition, Condition: r.Condition,
Data: ApiAlertQueriesFromAlertQueries(r.Data), Data: ApiAlertQueriesFromAlertQueries(r.Data),

View File

@ -1593,10 +1593,6 @@
], ],
"type": "string" "type": "string"
}, },
"id": {
"format": "int64",
"type": "integer"
},
"intervalSeconds": { "intervalSeconds": {
"format": "int64", "format": "int64",
"type": "integer" "type": "integer"
@ -1621,10 +1617,6 @@
"notification_settings": { "notification_settings": {
"$ref": "#/definitions/AlertRuleNotificationSettings" "$ref": "#/definitions/AlertRuleNotificationSettings"
}, },
"orgId": {
"format": "int64",
"type": "integer"
},
"provenance": { "provenance": {
"$ref": "#/definitions/Provenance" "$ref": "#/definitions/Provenance"
}, },

View File

@ -550,8 +550,6 @@ type PostableGrafanaRule struct {
// swagger:model // swagger:model
type GettableGrafanaRule struct { type GettableGrafanaRule struct {
ID int64 `json:"id" yaml:"id"`
OrgID int64 `json:"orgId" yaml:"orgId"`
Title string `json:"title" yaml:"title"` Title string `json:"title" yaml:"title"`
Condition string `json:"condition" yaml:"condition"` Condition string `json:"condition" yaml:"condition"`
Data []AlertQuery `json:"data" yaml:"data"` Data []AlertQuery `json:"data" yaml:"data"`

View File

@ -1593,10 +1593,6 @@
], ],
"type": "string" "type": "string"
}, },
"id": {
"format": "int64",
"type": "integer"
},
"intervalSeconds": { "intervalSeconds": {
"format": "int64", "format": "int64",
"type": "integer" "type": "integer"
@ -1621,10 +1617,6 @@
"notification_settings": { "notification_settings": {
"$ref": "#/definitions/AlertRuleNotificationSettings" "$ref": "#/definitions/AlertRuleNotificationSettings"
}, },
"orgId": {
"format": "int64",
"type": "integer"
},
"provenance": { "provenance": {
"$ref": "#/definitions/Provenance" "$ref": "#/definitions/Provenance"
}, },

View File

@ -5281,10 +5281,6 @@
"Error" "Error"
] ]
}, },
"id": {
"type": "integer",
"format": "int64"
},
"intervalSeconds": { "intervalSeconds": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
@ -5309,10 +5305,6 @@
"notification_settings": { "notification_settings": {
"$ref": "#/definitions/AlertRuleNotificationSettings" "$ref": "#/definitions/AlertRuleNotificationSettings"
}, },
"orgId": {
"type": "integer",
"format": "int64"
},
"provenance": { "provenance": {
"$ref": "#/definitions/Provenance" "$ref": "#/definitions/Provenance"
}, },

View File

@ -1143,8 +1143,6 @@ func TestIntegrationRulerRulesFilterByDashboard(t *testing.T) {
"__panelId__": "1" "__panelId__": "1"
}, },
"grafana_alert": { "grafana_alert": {
"id": 1,
"orgId": 1,
"title": "AlwaysFiring", "title": "AlwaysFiring",
"condition": "A", "condition": "A",
"data": [{ "data": [{
@ -1186,8 +1184,6 @@ func TestIntegrationRulerRulesFilterByDashboard(t *testing.T) {
"expr": "", "expr": "",
"for":"0s", "for":"0s",
"grafana_alert": { "grafana_alert": {
"id": 2,
"orgId": 1,
"title": "AlwaysFiringButSilenced", "title": "AlwaysFiringButSilenced",
"condition": "A", "condition": "A",
"data": [{ "data": [{
@ -1241,8 +1237,6 @@ func TestIntegrationRulerRulesFilterByDashboard(t *testing.T) {
"__panelId__": "1" "__panelId__": "1"
}, },
"grafana_alert": { "grafana_alert": {
"id": 1,
"orgId": 1,
"title": "AlwaysFiring", "title": "AlwaysFiring",
"condition": "A", "condition": "A",
"data": [{ "data": [{
@ -1583,7 +1577,6 @@ func TestIntegrationRuleCreate(t *testing.T) {
}, },
}, },
GrafanaManagedAlert: &apimodels.GettableGrafanaRule{ GrafanaManagedAlert: &apimodels.GettableGrafanaRule{
OrgID: 1,
Title: "test1 rule1", Title: "test1 rule1",
Condition: "A", Condition: "A",
Data: []apimodels.AlertQuery{ Data: []apimodels.AlertQuery{
@ -2526,8 +2519,6 @@ func TestIntegrationQuota(t *testing.T) {
"expr":"", "expr":"",
"for": "2m", "for": "2m",
"grafana_alert":{ "grafana_alert":{
"id":1,
"orgId":1,
"title":"Updated alert rule", "title":"Updated alert rule",
"condition":"A", "condition":"A",
"data":[ "data":[
@ -2641,8 +2632,6 @@ func TestIntegrationDeleteFolderWithRules(t *testing.T) {
"annotation1": "val1" "annotation1": "val1"
}, },
"grafana_alert": { "grafana_alert": {
"id": 1,
"orgId": 1,
"title": "rule under folder default", "title": "rule under folder default",
"condition": "A", "condition": "A",
"data": [ "data": [
@ -3124,8 +3113,6 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
"label1": "val1" "label1": "val1"
}, },
"grafana_alert":{ "grafana_alert":{
"id":1,
"orgId":1,
"title":"AlwaysFiring", "title":"AlwaysFiring",
"condition":"A", "condition":"A",
"data":[ "data":[
@ -3170,8 +3157,6 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
"expr":"", "expr":"",
"for": "0s", "for": "0s",
"grafana_alert":{ "grafana_alert":{
"id":2,
"orgId":1,
"title":"AlwaysFiringButSilenced", "title":"AlwaysFiringButSilenced",
"condition":"A", "condition":"A",
"data":[ "data":[
@ -3488,8 +3473,6 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
"label2": "val2" "label2": "val2"
}, },
"grafana_alert":{ "grafana_alert":{
"id":1,
"orgId":1,
"title":"AlwaysNormal", "title":"AlwaysNormal",
"condition":"A", "condition":"A",
"data":[ "data":[
@ -3607,8 +3590,6 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
"expr":"", "expr":"",
"for": "30s", "for": "30s",
"grafana_alert":{ "grafana_alert":{
"id":1,
"orgId":1,
"title":"AlwaysNormal", "title":"AlwaysNormal",
"condition":"A", "condition":"A",
"data":[ "data":[
@ -3705,8 +3686,6 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
"expr":"", "expr":"",
"for": "30s", "for": "30s",
"grafana_alert":{ "grafana_alert":{
"id":1,
"orgId":1,
"title":"AlwaysNormal", "title":"AlwaysNormal",
"condition":"A", "condition":"A",
"data":[ "data":[

View File

@ -12,8 +12,6 @@
"annotation": "test-annotation" "annotation": "test-annotation"
}, },
"grafana_alert": { "grafana_alert": {
"id": 1,
"orgId": 1,
"title": "Rule1", "title": "Rule1",
"condition": "A", "condition": "A",
"data": [ "data": [
@ -60,8 +58,6 @@
"annotation": "test-annotation" "annotation": "test-annotation"
}, },
"grafana_alert": { "grafana_alert": {
"id": 2,
"orgId": 1,
"title": "Rule2", "title": "Rule2",
"condition": "A", "condition": "A",
"data": [ "data": [

View File

@ -12,8 +12,6 @@
"annotation": "test-annotation" "annotation": "test-annotation"
}, },
"grafana_alert": { "grafana_alert": {
"id": 3,
"orgId": 1,
"title": "Rule3", "title": "Rule3",
"condition": "A", "condition": "A",
"data": [ "data": [

View File

@ -12,8 +12,6 @@
"annotation": "test-annotation" "annotation": "test-annotation"
}, },
"grafana_alert": { "grafana_alert": {
"id": 1,
"orgId": 1,
"title": "Rule1", "title": "Rule1",
"condition": "A", "condition": "A",
"data": [ "data": [
@ -60,8 +58,6 @@
"annotation": "test-annotation" "annotation": "test-annotation"
}, },
"grafana_alert": { "grafana_alert": {
"id": 2,
"orgId": 1,
"title": "Rule2", "title": "Rule2",
"condition": "A", "condition": "A",
"data": [ "data": [

View File

@ -16013,10 +16013,6 @@
"Error" "Error"
] ]
}, },
"id": {
"type": "integer",
"format": "int64"
},
"intervalSeconds": { "intervalSeconds": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
@ -16041,10 +16037,6 @@
"notification_settings": { "notification_settings": {
"$ref": "#/definitions/AlertRuleNotificationSettings" "$ref": "#/definitions/AlertRuleNotificationSettings"
}, },
"orgId": {
"type": "integer",
"format": "int64"
},
"provenance": { "provenance": {
"$ref": "#/definitions/Provenance" "$ref": "#/definitions/Provenance"
}, },

View File

@ -6087,10 +6087,6 @@
], ],
"type": "string" "type": "string"
}, },
"id": {
"format": "int64",
"type": "integer"
},
"intervalSeconds": { "intervalSeconds": {
"format": "int64", "format": "int64",
"type": "integer" "type": "integer"
@ -6115,10 +6111,6 @@
"notification_settings": { "notification_settings": {
"$ref": "#/components/schemas/AlertRuleNotificationSettings" "$ref": "#/components/schemas/AlertRuleNotificationSettings"
}, },
"orgId": {
"format": "int64",
"type": "integer"
},
"provenance": { "provenance": {
"$ref": "#/components/schemas/Provenance" "$ref": "#/components/schemas/Provenance"
}, },