diff --git a/Dockerfile b/Dockerfile index 55ee94652a6..7d061e38f7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -107,6 +107,7 @@ COPY apps/iam apps/iam COPY apps apps COPY kindsv2 kindsv2 COPY apps/alerting/notifications apps/alerting/notifications +COPY apps/alerting/alertenrichment apps/alerting/alertenrichment COPY pkg/codegen pkg/codegen COPY pkg/plugins/codegen pkg/plugins/codegen diff --git a/apps/alerting/alertenrichment/go.mod b/apps/alerting/alertenrichment/go.mod new file mode 100644 index 00000000000..3b07ef45283 --- /dev/null +++ b/apps/alerting/alertenrichment/go.mod @@ -0,0 +1,39 @@ +module github.com/grafana/grafana/apps/alerting/alertenrichment + +go 1.24.6 + +require ( + github.com/grafana/grafana-app-sdk v0.40.3 + github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250901080157-a0280d701b28 + k8s.io/apimachinery v0.33.3 + k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff +) + +require ( + github.com/emicklei/go-restful/v3 v3.12.1 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gnostic-models v0.6.9 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.9.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + golang.org/x/net v0.43.0 // indirect + golang.org/x/text v0.28.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect + sigs.k8s.io/yaml v1.5.0 // indirect +) diff --git a/apps/alerting/alertenrichment/go.sum b/apps/alerting/alertenrichment/go.sum new file mode 100644 index 00000000000..38e734949de --- /dev/null +++ b/apps/alerting/alertenrichment/go.sum @@ -0,0 +1,118 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= +github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw= +github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/grafana/grafana-app-sdk v0.40.3 h1:JFo7uAfbAJUfZ9neD7/4sODKm1xgu9zhckclH/N4DYU= +github.com/grafana/grafana-app-sdk v0.40.3/go.mod h1:j0KzHo3Sa6kd+lnwSScBNoV9Vobkg/YY9HtEjxpyPrk= +github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250901080157-a0280d701b28 h1:PgMfX4OPENz/iXmtDDIW9+poZY4UD0hhmXm7flVclDo= +github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250901080157-a0280d701b28/go.mod h1:av5N0Naq+8VV9MLF7zAkihy/mVq5UbS2EvRSJukDHlY= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= +github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/apimachinery v0.33.3 h1:4ZSrmNa0c/ZpZJhAgRdcsFcZOw1PQU1bALVQ0B3I5LA= +k8s.io/apimachinery v0.33.3/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4= +k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8= +k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0= +k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI= +sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +sigs.k8s.io/yaml v1.5.0 h1:M10b2U7aEUY6hRtU870n2VTPgR5RZiL/I6Lcc2F4NUQ= +sigs.k8s.io/yaml v1.5.0/go.mod h1:wZs27Rbxoai4C0f8/9urLZtZtF3avA3gKvGyPdDqTO4= diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/codec.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/codec.go new file mode 100644 index 00000000000..a06f2da8d7c --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/codec.go @@ -0,0 +1,24 @@ +package v0alpha1 + +import ( + "encoding/json" + "io" + + "github.com/grafana/grafana-app-sdk/resource" +) + +// AlertEnrichmentJSONCodec is a JSON codec for AlertEnrichment resources +type AlertEnrichmentJSONCodec struct{} + +// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into` +func (*AlertEnrichmentJSONCodec) Read(reader io.Reader, into resource.Object) error { + return json.NewDecoder(reader).Decode(into) +} + +// Write writes JSON-encoded bytes into `writer` marshaled from `from` +func (*AlertEnrichmentJSONCodec) Write(writer io.Writer, from resource.Object) error { + return json.NewEncoder(writer).Encode(from) +} + +// Interface compliance checks +var _ resource.Codec = &AlertEnrichmentJSONCodec{} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/constants.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/constants.go new file mode 100644 index 00000000000..4bcf351f19c --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/constants.go @@ -0,0 +1,18 @@ +package v0alpha1 + +import "k8s.io/apimachinery/pkg/runtime/schema" + +const ( + // APIGroup is the API group used by all kinds in this package + APIGroup = "alertenrichment.grafana.app" + // APIVersion is the API version used by all kinds in this package + APIVersion = "v0alpha1" +) + +var ( + // GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package + GroupVersion = schema.GroupVersion{ + Group: APIGroup, + Version: APIVersion, + } +) diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/doc.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/doc.go new file mode 100644 index 00000000000..22de3d039ad --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/doc.go @@ -0,0 +1,6 @@ +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta +// +groupName=alertenrichment.grafana.app + +package v0alpha1 diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/object.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/object.go new file mode 100644 index 00000000000..b14ad743049 --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/object.go @@ -0,0 +1,207 @@ +package v0alpha1 + +import ( + "fmt" + "time" + + "github.com/grafana/grafana-app-sdk/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" +) + +// App Platform resource.Object interface methods for AlertEnrichment + +func (o *AlertEnrichment) GetSpec() any { + return o.Spec +} + +func (o *AlertEnrichment) SetSpec(spec any) error { + cast, ok := spec.(AlertEnrichmentSpec) + if !ok { + return fmt.Errorf("cannot set spec type %#v, not of type AlertEnrichmentSpec", spec) + } + o.Spec = cast + return nil +} + +func (o *AlertEnrichment) GetSubresources() map[string]any { + return map[string]any{} +} + +func (o *AlertEnrichment) GetSubresource(name string) (any, bool) { + return nil, false +} + +func (o *AlertEnrichment) SetSubresource(name string, value any) error { + return fmt.Errorf("subresource %s does not exist", name) +} + +func (o *AlertEnrichment) Copy() resource.Object { + return resource.CopyObject(o) +} + +func (o *AlertEnrichment) GetStaticMetadata() resource.StaticMetadata { + gvk := o.GroupVersionKind() + return resource.StaticMetadata{ + Name: o.Name, + Namespace: o.Namespace, + Group: gvk.Group, + Version: gvk.Version, + Kind: gvk.Kind, + } +} + +func (o *AlertEnrichment) SetStaticMetadata(metadata resource.StaticMetadata) { + o.Name = metadata.Name + o.Namespace = metadata.Namespace + o.SetGroupVersionKind(schema.GroupVersionKind{ + Group: metadata.Group, + Version: metadata.Version, + Kind: metadata.Kind, + }) +} + +func (o *AlertEnrichment) GetCommonMetadata() resource.CommonMetadata { + dt := o.DeletionTimestamp + var deletionTimestamp *time.Time + if dt != nil { + deletionTimestamp = &dt.Time + } + // Legacy ExtraFields support + extraFields := make(map[string]any) + if o.Annotations != nil { + extraFields["annotations"] = o.Annotations + } + if o.ManagedFields != nil { + extraFields["managedFields"] = o.ManagedFields + } + if o.OwnerReferences != nil { + extraFields["ownerReferences"] = o.OwnerReferences + } + return resource.CommonMetadata{ + UID: string(o.UID), + ResourceVersion: o.ResourceVersion, + Generation: o.Generation, + Labels: o.Labels, + CreationTimestamp: o.CreationTimestamp.Time, + DeletionTimestamp: deletionTimestamp, + Finalizers: o.Finalizers, + UpdateTimestamp: o.GetUpdateTimestamp(), + CreatedBy: o.GetCreatedBy(), + UpdatedBy: o.GetUpdatedBy(), + ExtraFields: extraFields, + } +} + +func (o *AlertEnrichment) SetCommonMetadata(metadata resource.CommonMetadata) { + o.UID = types.UID(metadata.UID) + o.ResourceVersion = metadata.ResourceVersion + o.Generation = metadata.Generation + o.Labels = metadata.Labels + o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp) + if metadata.DeletionTimestamp != nil { + dt := metav1.NewTime(*metadata.DeletionTimestamp) + o.DeletionTimestamp = &dt + } else { + o.DeletionTimestamp = nil + } + o.Finalizers = metadata.Finalizers + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + if !metadata.UpdateTimestamp.IsZero() { + o.SetUpdateTimestamp(metadata.UpdateTimestamp) + } + if metadata.CreatedBy != "" { + o.SetCreatedBy(metadata.CreatedBy) + } + if metadata.UpdatedBy != "" { + o.SetUpdatedBy(metadata.UpdatedBy) + } + // Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields + if metadata.ExtraFields != nil { + if annotations, ok := metadata.ExtraFields["annotations"].(map[string]string); ok { + o.Annotations = annotations + } + if managedFields, ok := metadata.ExtraFields["managedFields"].([]metav1.ManagedFieldsEntry); ok { + o.ManagedFields = managedFields + } + if ownerReferences, ok := metadata.ExtraFields["ownerReferences"].([]metav1.OwnerReference); ok { + o.OwnerReferences = ownerReferences + } + } +} + +func (o *AlertEnrichment) GetCreatedBy() string { + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + return o.Annotations["grafana.com/createdBy"] +} + +func (o *AlertEnrichment) SetCreatedBy(createdBy string) { + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + o.Annotations["grafana.com/createdBy"] = createdBy +} + +func (o *AlertEnrichment) GetUpdateTimestamp() time.Time { + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + parsed, _ := time.Parse(time.RFC3339, o.Annotations["grafana.com/updateTimestamp"]) + return parsed +} + +func (o *AlertEnrichment) SetUpdateTimestamp(updateTimestamp time.Time) { + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + o.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339) +} + +func (o *AlertEnrichment) GetUpdatedBy() string { + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + return o.Annotations["grafana.com/updatedBy"] +} + +func (o *AlertEnrichment) SetUpdatedBy(updatedBy string) { + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + o.Annotations["grafana.com/updatedBy"] = updatedBy +} + +// AlertEnrichmentList also needs to implement resource.ListObject +func (o *AlertEnrichmentList) Copy() resource.ListObject { + cpy := &AlertEnrichmentList{ + TypeMeta: o.TypeMeta, + Items: make([]AlertEnrichment, len(o.Items)), + } + o.ListMeta.DeepCopyInto(&cpy.ListMeta) + for i := 0; i < len(o.Items); i++ { + o.Items[i].DeepCopyInto(&cpy.Items[i]) + } + return cpy +} + +func (o *AlertEnrichmentList) GetItems() []resource.Object { + items := make([]resource.Object, len(o.Items)) + for i, item := range o.Items { + items[i] = &item + } + return items +} + +func (o *AlertEnrichmentList) SetItems(items []resource.Object) { + o.Items = make([]AlertEnrichment, len(items)) + for i, item := range items { + if ae, ok := item.(*AlertEnrichment); ok { + o.Items[i] = *ae + } + } +} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/schema.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/schema.go new file mode 100644 index 00000000000..f43bef3e0b4 --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/schema.go @@ -0,0 +1,27 @@ +package v0alpha1 + +import ( + "github.com/grafana/grafana-app-sdk/resource" +) + +// schema is unexported to prevent accidental overwrites +var ( + schemaAlertEnrichment = resource.NewSimpleSchema(APIGroup, APIVersion, &AlertEnrichment{}, &AlertEnrichmentList{}, resource.WithKind("AlertEnrichment"), + resource.WithPlural("alertenrichments"), resource.WithScope(resource.NamespacedScope)) + kindAlertEnrichment = resource.Kind{ + Schema: schemaAlertEnrichment, + Codecs: map[resource.KindEncoding]resource.Codec{ + resource.KindEncodingJSON: &AlertEnrichmentJSONCodec{}, + }, + } +) + +// AlertEnrichmentKind returns a resource.Kind for this Schema with a JSON codec +func AlertEnrichmentKind() resource.Kind { + return kindAlertEnrichment +} + +// AlertEnrichmentSchema returns a resource.SimpleSchema representation of AlertEnrichment +func AlertEnrichmentSchema() *resource.SimpleSchema { + return schemaAlertEnrichment +} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/types.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/types.go new file mode 100644 index 00000000000..49195a8ecf4 --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/types.go @@ -0,0 +1,233 @@ +package v0alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + common "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1" +) + +// JSONSchema descriptions help the enrichment suggest API to generate enrichment configurations. + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type AlertEnrichment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AlertEnrichmentSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type AlertEnrichmentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []AlertEnrichment `json:"items,omitempty"` +} + +// AlertEnrichmentSpec specifies an alert enrichment pipeline. +type AlertEnrichmentSpec struct { + // Title of the alert enrichment. + // +kubebuilder:validation:Required + Title string `json:"title" yaml:"title" jsonschema:"description=Title of the alert enrichment"` + + // Description of the alert enrichment. + Description string `json:"description,omitempty" yaml:"description,omitempty" jsonschema:"description=Human‑readable description"` + + // Alert rules for which to run the enrichment for. + // If not set, the enrichment runs for all alert rules. + // +listType=set + AlertRuleUIDs []string `json:"alertRuleUids,omitempty" yaml:"alertRuleUids,omitempty" jsonschema:"description=UIDs of alert rules this enrichment applies to (empty = all)"` + + // LabelMatchers optionally restricts when this enrichment runs. + LabelMatchers []Matcher `json:"labelMatchers,omitempty" yaml:"labelMatchers,omitempty" jsonschema:"description=Label matchers that must be satisfied by the alert for this enrichment to run"` + + // AnnotationMatchers optionally restricts when this enrichment runs. + AnnotationMatchers []Matcher `json:"annotationMatchers,omitempty" yaml:"annotationMatchers,omitempty" jsonschema:"description=Annotation matchers that must be satisfied by the alert for this enrichment to run"` + + // Receivers optionally restricts the enrichment to one or more receiver names. + // If not set, the enrichment runs for alerts coming from all receivers. + // +listType=set + Receivers []string `json:"receivers,omitempty" yaml:"receivers,omitempty" jsonschema:"description=Alertmanager receiver names to match (empty = all)"` + + // Steps of the enrichment pipeline. + Steps []Step `json:"steps" yaml:"steps" jsonschema:"description=Ordered list of enricher steps"` +} + +// Type of comparison performed by the matcher. This mimics Alertmanager matchers. +// +enum +type StepType string + +// Defines values for MatchType. +const ( + StepTypeEnricher StepType = "enricher" + StepTypeConditional StepType = "conditional" +) + +// Step represent an invocation of a single enricher. +type Step struct { + Type StepType `json:"type" yaml:"type" jsonschema:"description=Step kind: 'enricher' or 'conditional'"` + + // Timeout is the maximum about of time this specific enrichment is allowed to take. + Timeout metav1.Duration `json:"timeout" yaml:"timeout" jsonschema:"description=Maximum execution duration for this step, for example '5s'"` + + // Enricher specifies what enricher to run and it's configuration. + Enricher *EnricherConfig `json:"enricher,omitempty" yaml:"enricher,omitempty" jsonschema:"description=Enricher configuration"` + + // Conditional allows branching to specifies what enricher to run and it's configuration. + Conditional *Conditional `json:"conditional,omitempty" yaml:"conditional,omitempty" jsonschema:"description=Conditional enricher configuration that branches based on the condition"` +} + +type Conditional struct { + // If is the condition to evaluate. + If Condition `json:"if" yaml:"if" jsonschema:"description=Condition to evaluate before running the enrichment steps"` + + // Then is the enrichment steps to perform if all the conditions above are true. + Then []Step `json:"then" yaml:"then" jsonschema:"description=Steps executed when the condition is true"` + + // Else is the enrichment steps to perform otherwise. + Else []Step `json:"else,omitempty" yaml:"else,omitempty" jsonschema:"description=Steps executed when the condition is false"` +} + +type Condition struct { + // LabelMatchers optionally specifies the condition to require matching label values. + LabelMatchers []Matcher `json:"labelMatchers,omitempty" yaml:"labelMatchers,omitempty" jsonschema:"description=Label matchers that must be satisfied"` + + // AnnotationMatchers optionally restricts when the per-alert enrichments are run. + AnnotationMatchers []Matcher `json:"annotationMatchers,omitempty" yaml:"annotationMatchers,omitempty" jsonschema:"description=Annotation matchers that must be satisfied"` + + // DataSourceQuery is a data source query to run. If the query returns a non-zero value, + // then the condition is taken to be true. + DataSourceQuery *RawDataSourceQuery `json:"dataSourceQuery,omitempty" yaml:"dataSourceQuery,omitempty" jsonschema:"description=Data source query to run to evaluate the condition"` +} + +// Matcher is used to match label (or annotation) values. +type Matcher struct { + Type MatchType `json:"type" yaml:"type" jsonschema:"description=Comparison operator ('=', '!=', '=~', '!~')"` + Name string `json:"name" yaml:"name" jsonschema:"description=Label/annotation key"` + Value string `json:"value" yaml:"value" jsonschema:"description=Value or regex pattern to match"` +} + +// Type of comparison performed by the matcher. This mimics Alertmanager matchers. +// +enum +type MatchType string + +// Defines values for MatchType. +const ( + MatchTypeEqual MatchType = "=" + MatchTypeNotEqual MatchType = "!=" + MatchTypeRegexp MatchType = "=~" + MatchNotRegexp MatchType = "!~" +) + +// Type of enricher +// +enum +type EnricherType string + +// Defines values for EnricherType. +const ( + EnricherTypeAssign EnricherType = "assign" + EnricherTypeExternal EnricherType = "external" + EnricherTypeDataSourceQuery EnricherType = "dsquery" + EnricherTypeSift EnricherType = "sift" + EnricherTypeAsserts EnricherType = "asserts" + EnricherTypeExplain EnricherType = "explain" + EnricherTypeLoop EnricherType = "loop" +) + +// EnricherConfig is a discriminated union of enricher configurations. +type EnricherConfig struct { + Type EnricherType `json:"type" yaml:"type" jsonschema:"description=Enricher type ('assign', 'external', 'dsquery', 'sift', 'asserts', 'explain', 'loop')"` + + Assign *AssignEnricher `json:"assign,omitempty" yaml:"assign,omitempty" jsonschema:"description=Assign enricher settings"` + External *ExternalEnricher `json:"external,omitempty" yaml:"external,omitempty" jsonschema:"description=External HTTP enricher settings"` + DataSource *DataSourceEnricher `json:"dataSource,omitempty" yaml:"dataSource,omitempty" jsonschema:"description=Data source query enricher settings"` + Sift *SiftEnricher `json:"sift,omitempty" yaml:"sift,omitempty" jsonschema:"description=Sift enricher settings"` + Asserts *AssertsEnricher `json:"asserts,omitempty" yaml:"asserts,omitempty" jsonschema:"description=Asserts enricher settings"` + Explain *ExplainEnricher `json:"explain,omitempty" yaml:"explain,omitempty" jsonschema:"description=Explain enricher settings"` + Loop *LoopEnricher `json:"loop,omitempty" yaml:"loop,omitempty" jsonschema:"description=Loop enricher settings"` +} + +// AssignEnricher configures an enricher which assigns annotations. +type AssignEnricher struct { + // Annotations to change and values to set them to. + // +listType=map + // +listMapKey=name + Annotations []Assignment `json:"annotations" yaml:"annotations" jsonschema:"description=Annotations to set on the alert"` +} + +type Assignment struct { + // Name of the annotation to assign. + Name string `json:"name" yaml:"name" jsonschema:"description=Annotation key"` + // Value to assign to the annotation. Can use Go template format, with access to + // annotations and labels via e.g. {{$annotations.x}} + Value string `json:"value" yaml:"value" jsonschema:"description=Template value to apply, for example '{{ $labels.instance }} is down'"` +} + +// ExternalEnricher configures an enricher which calls an external service. +type ExternalEnricher struct { + // URL of the external HTTP service to call out to. + URL string `json:"url" yaml:"url" jsonschema:"description=HTTP endpoint to call for enrichment"` +} + +// Type of data source query +// +enum +type DataSourceQueryType string + +// Defines values for EnricherType. +const ( + DataSourceQueryTypeRaw DataSourceQueryType = "raw" + DataSourceQueryTypeLogs DataSourceQueryType = "logs" +) + +// DataSourceEnricher configures an enricher which calls an external service. +type DataSourceEnricher struct { + Type DataSourceQueryType `json:"type" yaml:"type" jsonschema:"description=Data source query type ('raw', 'logs')"` + + Raw *RawDataSourceQuery `json:"raw,omitempty" yaml:"raw,omitempty" jsonschema:"description=Raw query definition"` + Logs *LogsDataSourceQuery `json:"logs,omitempty" yaml:"logs,omitempty" jsonschema:"description=Logs query definition"` +} + +// RawDataSourceQuery allows defining the entire query request +type RawDataSourceQuery struct { + // The data source request to perform. + Request common.Unstructured `json:"request,omitempty" yaml:"request,omitempty" jsonschema:"description=Grafana data source request payload"` + + // The RefID of the response to use. Not required if only a single query is given. + RefID string `json:"refId,omitempty" yaml:"refId,omitempty" jsonschema:"description=RefID of the response to use, needed if multiple queries are given"` +} + +// LogsDataSourceQuery is a simplified method of describing a logs query, +// typically those that return data frames with a "Line" field. +type LogsDataSourceQuery struct { + // The datasource plugin type + DataSourceType string `json:"dataSourceType" yaml:"dataSourceType" jsonschema:"description=Data source plugin type (e.g. 'prometheus', 'loki')"` + + // Datasource UID + DataSourceUID string `json:"dataSourceUid,omitempty" yaml:"dataSourceUid,omitempty" jsonschema:"description=UID of the data source to query"` + + // The logs query to run. + Expr string `json:"expr" yaml:"expr" jsonschema:"description=Log query expression"` + + // Number of log lines to add to the alert. Defaults to 3. + MaxLines int `json:"maxLines,omitempty" yaml:"maxLines,omitempty" jsonschema:"description=Maximum number of log lines to include, defaults to 3"` +} + +// SiftEnricher configures an enricher which calls into Sift. +type SiftEnricher struct { + // In the future, there may be configuration options. +} + +// AssertsEnricher configures an enricher which calls into Asserts. +type AssertsEnricher struct { + // In the future, there may be configuration options. +} + +// ExplainEnricher uses LLM to generate explanations for alerts. +type ExplainEnricher struct { + Annotation string `json:"annotation" yaml:"annotation" jsonschema:"description=Annotation name to set the explanation in, by default 'ai_explanation'"` +} + +// LoopEnricher configures an enricher which calls into Loop. +type LoopEnricher struct { + // In the future, there may be configuration options. +} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.deepcopy.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..78f64afc3ee --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.deepcopy.go @@ -0,0 +1,463 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertEnrichment) DeepCopyInto(out *AlertEnrichment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertEnrichment. +func (in *AlertEnrichment) DeepCopy() *AlertEnrichment { + if in == nil { + return nil + } + out := new(AlertEnrichment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AlertEnrichment) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertEnrichmentJSONCodec) DeepCopyInto(out *AlertEnrichmentJSONCodec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertEnrichmentJSONCodec. +func (in *AlertEnrichmentJSONCodec) DeepCopy() *AlertEnrichmentJSONCodec { + if in == nil { + return nil + } + out := new(AlertEnrichmentJSONCodec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertEnrichmentList) DeepCopyInto(out *AlertEnrichmentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AlertEnrichment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertEnrichmentList. +func (in *AlertEnrichmentList) DeepCopy() *AlertEnrichmentList { + if in == nil { + return nil + } + out := new(AlertEnrichmentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AlertEnrichmentList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertEnrichmentSpec) DeepCopyInto(out *AlertEnrichmentSpec) { + *out = *in + if in.AlertRuleUIDs != nil { + in, out := &in.AlertRuleUIDs, &out.AlertRuleUIDs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.LabelMatchers != nil { + in, out := &in.LabelMatchers, &out.LabelMatchers + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.AnnotationMatchers != nil { + in, out := &in.AnnotationMatchers, &out.AnnotationMatchers + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.Receivers != nil { + in, out := &in.Receivers, &out.Receivers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertEnrichmentSpec. +func (in *AlertEnrichmentSpec) DeepCopy() *AlertEnrichmentSpec { + if in == nil { + return nil + } + out := new(AlertEnrichmentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AssertsEnricher) DeepCopyInto(out *AssertsEnricher) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AssertsEnricher. +func (in *AssertsEnricher) DeepCopy() *AssertsEnricher { + if in == nil { + return nil + } + out := new(AssertsEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AssignEnricher) DeepCopyInto(out *AssignEnricher) { + *out = *in + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make([]Assignment, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AssignEnricher. +func (in *AssignEnricher) DeepCopy() *AssignEnricher { + if in == nil { + return nil + } + out := new(AssignEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Assignment) DeepCopyInto(out *Assignment) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Assignment. +func (in *Assignment) DeepCopy() *Assignment { + if in == nil { + return nil + } + out := new(Assignment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + if in.LabelMatchers != nil { + in, out := &in.LabelMatchers, &out.LabelMatchers + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.AnnotationMatchers != nil { + in, out := &in.AnnotationMatchers, &out.AnnotationMatchers + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.DataSourceQuery != nil { + in, out := &in.DataSourceQuery, &out.DataSourceQuery + *out = new(RawDataSourceQuery) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Conditional) DeepCopyInto(out *Conditional) { + *out = *in + in.If.DeepCopyInto(&out.If) + if in.Then != nil { + in, out := &in.Then, &out.Then + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Else != nil { + in, out := &in.Else, &out.Else + *out = make([]Step, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Conditional. +func (in *Conditional) DeepCopy() *Conditional { + if in == nil { + return nil + } + out := new(Conditional) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataSourceEnricher) DeepCopyInto(out *DataSourceEnricher) { + *out = *in + if in.Raw != nil { + in, out := &in.Raw, &out.Raw + *out = new(RawDataSourceQuery) + (*in).DeepCopyInto(*out) + } + if in.Logs != nil { + in, out := &in.Logs, &out.Logs + *out = new(LogsDataSourceQuery) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceEnricher. +func (in *DataSourceEnricher) DeepCopy() *DataSourceEnricher { + if in == nil { + return nil + } + out := new(DataSourceEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnricherConfig) DeepCopyInto(out *EnricherConfig) { + *out = *in + if in.Assign != nil { + in, out := &in.Assign, &out.Assign + *out = new(AssignEnricher) + (*in).DeepCopyInto(*out) + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(ExternalEnricher) + **out = **in + } + if in.DataSource != nil { + in, out := &in.DataSource, &out.DataSource + *out = new(DataSourceEnricher) + (*in).DeepCopyInto(*out) + } + if in.Sift != nil { + in, out := &in.Sift, &out.Sift + *out = new(SiftEnricher) + **out = **in + } + if in.Asserts != nil { + in, out := &in.Asserts, &out.Asserts + *out = new(AssertsEnricher) + **out = **in + } + if in.Explain != nil { + in, out := &in.Explain, &out.Explain + *out = new(ExplainEnricher) + **out = **in + } + if in.Loop != nil { + in, out := &in.Loop, &out.Loop + *out = new(LoopEnricher) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnricherConfig. +func (in *EnricherConfig) DeepCopy() *EnricherConfig { + if in == nil { + return nil + } + out := new(EnricherConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExplainEnricher) DeepCopyInto(out *ExplainEnricher) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExplainEnricher. +func (in *ExplainEnricher) DeepCopy() *ExplainEnricher { + if in == nil { + return nil + } + out := new(ExplainEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExternalEnricher) DeepCopyInto(out *ExternalEnricher) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalEnricher. +func (in *ExternalEnricher) DeepCopy() *ExternalEnricher { + if in == nil { + return nil + } + out := new(ExternalEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogsDataSourceQuery) DeepCopyInto(out *LogsDataSourceQuery) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogsDataSourceQuery. +func (in *LogsDataSourceQuery) DeepCopy() *LogsDataSourceQuery { + if in == nil { + return nil + } + out := new(LogsDataSourceQuery) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoopEnricher) DeepCopyInto(out *LoopEnricher) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoopEnricher. +func (in *LoopEnricher) DeepCopy() *LoopEnricher { + if in == nil { + return nil + } + out := new(LoopEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Matcher) DeepCopyInto(out *Matcher) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Matcher. +func (in *Matcher) DeepCopy() *Matcher { + if in == nil { + return nil + } + out := new(Matcher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RawDataSourceQuery) DeepCopyInto(out *RawDataSourceQuery) { + *out = *in + in.Request.DeepCopyInto(&out.Request) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RawDataSourceQuery. +func (in *RawDataSourceQuery) DeepCopy() *RawDataSourceQuery { + if in == nil { + return nil + } + out := new(RawDataSourceQuery) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SiftEnricher) DeepCopyInto(out *SiftEnricher) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiftEnricher. +func (in *SiftEnricher) DeepCopy() *SiftEnricher { + if in == nil { + return nil + } + out := new(SiftEnricher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Step) DeepCopyInto(out *Step) { + *out = *in + out.Timeout = in.Timeout + if in.Enricher != nil { + in, out := &in.Enricher, &out.Enricher + *out = new(EnricherConfig) + (*in).DeepCopyInto(*out) + } + if in.Conditional != nil { + in, out := &in.Conditional, &out.Conditional + *out = new(Conditional) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Step. +func (in *Step) DeepCopy() *Step { + if in == nil { + return nil + } + out := new(Step) + in.DeepCopyInto(out) + return out +} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.defaults.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.defaults.go new file mode 100644 index 00000000000..238fc2f4edc --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.defaults.go @@ -0,0 +1,19 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.openapi.go b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.openapi.go new file mode 100644 index 00000000000..f1bc9d03f6c --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.openapi.go @@ -0,0 +1,736 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by openapi-gen. DO NOT EDIT. + +package v0alpha1 + +import ( + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichment": schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichment(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichmentJSONCodec": schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichmentJSONCodec(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichmentList": schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichmentList(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichmentSpec": schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichmentSpec(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AssertsEnricher": schema_pkg_apis_alertenrichment_v0alpha1_AssertsEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AssignEnricher": schema_pkg_apis_alertenrichment_v0alpha1_AssignEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Assignment": schema_pkg_apis_alertenrichment_v0alpha1_Assignment(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Condition": schema_pkg_apis_alertenrichment_v0alpha1_Condition(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Conditional": schema_pkg_apis_alertenrichment_v0alpha1_Conditional(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.DataSourceEnricher": schema_pkg_apis_alertenrichment_v0alpha1_DataSourceEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.EnricherConfig": schema_pkg_apis_alertenrichment_v0alpha1_EnricherConfig(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.ExplainEnricher": schema_pkg_apis_alertenrichment_v0alpha1_ExplainEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.ExternalEnricher": schema_pkg_apis_alertenrichment_v0alpha1_ExternalEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.LogsDataSourceQuery": schema_pkg_apis_alertenrichment_v0alpha1_LogsDataSourceQuery(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.LoopEnricher": schema_pkg_apis_alertenrichment_v0alpha1_LoopEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher": schema_pkg_apis_alertenrichment_v0alpha1_Matcher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.RawDataSourceQuery": schema_pkg_apis_alertenrichment_v0alpha1_RawDataSourceQuery(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.SiftEnricher": schema_pkg_apis_alertenrichment_v0alpha1_SiftEnricher(ref), + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Step": schema_pkg_apis_alertenrichment_v0alpha1_Step(ref), + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichment(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichmentSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichmentSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichmentJSONCodec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertEnrichmentJSONCodec is a JSON codec for AlertEnrichment resources", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichmentList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichment"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AlertEnrichment", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_AlertEnrichmentSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertEnrichmentSpec specifies an alert enrichment pipeline.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "title": { + SchemaProps: spec.SchemaProps{ + Description: "Title of the alert enrichment.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description of the alert enrichment.", + Type: []string{"string"}, + Format: "", + }, + }, + "alertRuleUids": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Alert rules for which to run the enrichment for. If not set, the enrichment runs for all alert rules.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "labelMatchers": { + SchemaProps: spec.SchemaProps{ + Description: "LabelMatchers optionally restricts when this enrichment runs.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher"), + }, + }, + }, + }, + }, + "annotationMatchers": { + SchemaProps: spec.SchemaProps{ + Description: "AnnotationMatchers optionally restricts when this enrichment runs.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher"), + }, + }, + }, + }, + }, + "receivers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Receivers optionally restricts the enrichment to one or more receiver names. If not set, the enrichment runs for alerts coming from all receivers.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "steps": { + SchemaProps: spec.SchemaProps{ + Description: "Steps of the enrichment pipeline.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Step"), + }, + }, + }, + }, + }, + }, + Required: []string{"title", "steps"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Step"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_AssertsEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AssertsEnricher configures an enricher which calls into Asserts.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_AssignEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AssignEnricher configures an enricher which assigns annotations.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "annotations": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Annotations to change and values to set them to.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Assignment"), + }, + }, + }, + }, + }, + }, + Required: []string{"annotations"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Assignment"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_Assignment(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the annotation to assign.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value to assign to the annotation. Can use Go template format, with access to annotations and labels via e.g. {{$annotations.x}}", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "value"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "labelMatchers": { + SchemaProps: spec.SchemaProps{ + Description: "LabelMatchers optionally specifies the condition to require matching label values.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher"), + }, + }, + }, + }, + }, + "annotationMatchers": { + SchemaProps: spec.SchemaProps{ + Description: "AnnotationMatchers optionally restricts when the per-alert enrichments are run.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher"), + }, + }, + }, + }, + }, + "dataSourceQuery": { + SchemaProps: spec.SchemaProps{ + Description: "DataSourceQuery is a data source query to run. If the query returns a non-zero value, then the condition is taken to be true.", + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.RawDataSourceQuery"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Matcher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.RawDataSourceQuery"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_Conditional(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "if": { + SchemaProps: spec.SchemaProps{ + Description: "If is the condition to evaluate.", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Condition"), + }, + }, + "then": { + SchemaProps: spec.SchemaProps{ + Description: "Then is the enrichment steps to perform if all the conditions above are true.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Step"), + }, + }, + }, + }, + }, + "else": { + SchemaProps: spec.SchemaProps{ + Description: "Else is the enrichment steps to perform otherwise.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Step"), + }, + }, + }, + }, + }, + }, + Required: []string{"if", "then"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Condition", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Step"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_DataSourceEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DataSourceEnricher configures an enricher which calls an external service.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"logs\"`\n - `\"raw\"`", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"logs", "raw"}, + }, + }, + "raw": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.RawDataSourceQuery"), + }, + }, + "logs": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.LogsDataSourceQuery"), + }, + }, + }, + Required: []string{"type"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.LogsDataSourceQuery", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.RawDataSourceQuery"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_EnricherConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnricherConfig is a discriminated union of enricher configurations.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"asserts\"`\n - `\"assign\"`\n - `\"dsquery\"`\n - `\"explain\"`\n - `\"external\"`\n - `\"loop\"`\n - `\"sift\"`", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"asserts", "assign", "dsquery", "explain", "external", "loop", "sift"}, + }, + }, + "assign": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AssignEnricher"), + }, + }, + "external": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.ExternalEnricher"), + }, + }, + "dataSource": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.DataSourceEnricher"), + }, + }, + "sift": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.SiftEnricher"), + }, + }, + "asserts": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AssertsEnricher"), + }, + }, + "explain": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.ExplainEnricher"), + }, + }, + "loop": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.LoopEnricher"), + }, + }, + }, + Required: []string{"type"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AssertsEnricher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.AssignEnricher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.DataSourceEnricher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.ExplainEnricher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.ExternalEnricher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.LoopEnricher", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.SiftEnricher"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_ExplainEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ExplainEnricher uses LLM to generate explanations for alerts.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "annotation": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"annotation"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_ExternalEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ExternalEnricher configures an enricher which calls an external service.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL of the external HTTP service to call out to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_LogsDataSourceQuery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LogsDataSourceQuery is a simplified method of describing a logs query, typically those that return data frames with a \"Line\" field.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "dataSourceType": { + SchemaProps: spec.SchemaProps{ + Description: "The datasource plugin type", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "dataSourceUid": { + SchemaProps: spec.SchemaProps{ + Description: "Datasource UID", + Type: []string{"string"}, + Format: "", + }, + }, + "expr": { + SchemaProps: spec.SchemaProps{ + Description: "The logs query to run.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "maxLines": { + SchemaProps: spec.SchemaProps{ + Description: "Number of log lines to add to the alert. Defaults to 3.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"dataSourceType", "expr"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_LoopEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LoopEnricher configures an enricher which calls into Loop.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_Matcher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Matcher is used to match label (or annotation) values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"!=\"`\n - `\"!~\"`\n - `\"=\"`\n - `\"=~\"`", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"!=", "!~", "=", "=~"}, + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "name", "value"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_RawDataSourceQuery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RawDataSourceQuery allows defining the entire query request", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "request": { + SchemaProps: spec.SchemaProps{ + Description: "The data source request to perform.", + Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"), + }, + }, + "refId": { + SchemaProps: spec.SchemaProps{ + Description: "The RefID of the response to use. Not required if only a single query is given.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"}, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_SiftEnricher(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SiftEnricher configures an enricher which calls into Sift.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_alertenrichment_v0alpha1_Step(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Step represent an invocation of a single enricher.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Possible enum values:\n - `\"conditional\"`\n - `\"enricher\"`", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"conditional", "enricher"}, + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout is the maximum about of time this specific enrichment is allowed to take.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "enricher": { + SchemaProps: spec.SchemaProps{ + Description: "Enricher specifies what enricher to run and it's configuration.", + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.EnricherConfig"), + }, + }, + "conditional": { + SchemaProps: spec.SchemaProps{ + Description: "Conditional allows branching to specifies what enricher to run and it's configuration.", + Ref: ref("github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Conditional"), + }, + }, + }, + Required: []string{"type", "timeout"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.Conditional", "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1.EnricherConfig", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} diff --git a/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.openapi_violation_exceptions.list b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.openapi_violation_exceptions.list new file mode 100644 index 00000000000..eb01579cb52 --- /dev/null +++ b/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1/zz_generated.openapi_violation_exceptions.list @@ -0,0 +1,11 @@ +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,AlertEnrichmentSpec,AnnotationMatchers +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,AlertEnrichmentSpec,LabelMatchers +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,AlertEnrichmentSpec,Steps +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,Condition,AnnotationMatchers +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,Condition,LabelMatchers +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,Conditional,Else +API rule violation: list_type_missing,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,Conditional,Then +API rule violation: names_match,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,AlertEnrichmentSpec,AlertRuleUIDs +API rule violation: names_match,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,LogsDataSourceQuery,DataSourceUID +API rule violation: names_match,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,RawDataSourceQuery,RefID +API rule violation: streaming_list_type_json_tags,github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1,AlertEnrichmentList,Items diff --git a/go.mod b/go.mod index 818e95e7f9f..e19d19dcb85 100644 --- a/go.mod +++ b/go.mod @@ -233,6 +233,7 @@ require ( require ( github.com/grafana/grafana/apps/advisor v0.0.0 // @grafana/plugins-platform-backend + github.com/grafana/grafana/apps/alerting/alertenrichment v0.0.0 // @grafana/alerting-backend github.com/grafana/grafana/apps/alerting/notifications v0.0.0 // @grafana/alerting-backend github.com/grafana/grafana/apps/dashboard v0.0.0 // @grafana/grafana-app-platform-squad @grafana/dashboards-squad github.com/grafana/grafana/apps/folder v0.0.0 // @grafana/grafana-search-and-storage @@ -258,6 +259,7 @@ require ( // Replace the workspace versions replace ( github.com/grafana/grafana/apps/advisor => ./apps/advisor + github.com/grafana/grafana/apps/alerting/alertenrichment => ./apps/alerting/alertenrichment github.com/grafana/grafana/apps/alerting/notifications => ./apps/alerting/notifications github.com/grafana/grafana/apps/dashboard => ./apps/dashboard github.com/grafana/grafana/apps/folder => ./apps/folder diff --git a/go.work b/go.work index d39d2cfac5b..4241fca5f92 100644 --- a/go.work +++ b/go.work @@ -6,6 +6,7 @@ go 1.24.6 use ( . // skip:golangci-lint ./apps/advisor + ./apps/alerting/alertenrichment ./apps/alerting/notifications ./apps/dashboard ./apps/folder diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index bf3430d135c..c4947c932c1 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -90,6 +90,7 @@ grafana::codegen:run apps/dashboard/pkg grafana::codegen:run apps/provisioning/pkg grafana::codegen:run apps/folder/pkg grafana::codegen:run apps/preferences/pkg +grafana::codegen:run apps/alerting/alertenrichment/pkg if [ -d "pkg/extensions/apis" ]; then grafana::codegen:run pkg/extensions diff --git a/pkg/extensions/enterprise_imports.go b/pkg/extensions/enterprise_imports.go index 504d1378bc7..2e9f8e97955 100644 --- a/pkg/extensions/enterprise_imports.go +++ b/pkg/extensions/enterprise_imports.go @@ -53,5 +53,6 @@ import ( _ "github.com/grafana/e2e" _ "github.com/grafana/gofpdf" _ "github.com/grafana/gomemcache/memcache" + _ "github.com/grafana/grafana/apps/alerting/alertenrichment/pkg/apis/alertenrichment/v0alpha1" _ "github.com/grafana/tempo/pkg/traceql" )