grafana/pkg/services/ngalert/provisioning
Giuseppe Guerra a89202eab2
Plugins: Improve instrumentation by adding metrics and tracing (#61035)
* WIP: Plugins tracing

* Trace ID middleware

* Add prometheus metrics and tracing to plugins updater

* Add TODOs

* Add instrumented http client

* Add tracing to grafana update checker

* Goimports

* Moved plugins tracing to middleware

* goimports, fix tests

* Removed X-Trace-Id header

* Fix comment in NewTracingHeaderMiddleware

* Add metrics to instrumented http client

* Add instrumented http client options

* Removed unused function

* Switch to contextual logger

* Refactoring, fix tests

* Moved InstrumentedHTTPClient and PrometheusMetrics to their own package

* Tracing middleware: handle errors

* Report span status codes when recording errors

* Add tests for tracing middleware

* Moved fakeSpan and fakeTracer to pkg/infra/tracing

* Add TestHTTPClientTracing

* Lint

* Changes after PR review

* Tests: Made "ended" in FakeSpan private, allow calling End only once

* Testing: panic in FakeSpan if span already ended

* Refactoring: Simplify Grafana updater checks

* Refactoring: Simplify plugins updater error checks and logs

* Fix wrong call to checkForUpdates -> instrumentedCheckForUpdates

* Tests: Fix wrong call to checkForUpdates -> instrumentedCheckForUpdates

* Log update checks duration, use Info log level for check succeeded logs

* Add plugin context span attributes in tracing_middleware

* Refactor prometheus metrics as httpclient middleware

* Fix call to ProvidePluginsService in plugins_test.go

* Propagate context to update checker outgoing http requests

* Plugin client tracing middleware: Removed operation name in status

* Fix tests

* Goimports tracing_middleware.go

* Goimports

* Fix imports

* Changed span name to plugins client middleware

* Add span name assertion in TestTracingMiddleware

* Removed Prometheus metrics middleware from grafana and plugins updatechecker

* Add span attributes for ds name, type, uid, panel and dashboard ids

* Fix http header reading in tracing middlewares

* Use contexthandler.FromContext, add X-Query-Group-Id

* Add test for RunStream

* Fix imports

* Changes from PR review

* TestTracingMiddleware: Changed assert to require for didPanic assertion

* Lint

* Fix imports
2023-03-28 11:01:06 +02:00
..
alert_rules_test.go Expressions: Fixes the issue showing expressions editor (#62510) 2023-01-31 18:50:10 +01:00
alert_rules.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
config.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
contactpoints_test.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
contactpoints.go Alerting: replace usage of simplejson to json.RawMessage in NotificationChannelConfig (#60423) 2022-12-16 13:01:06 -05:00
errors.go Alerting: Code-gen parsing of URL parameters and fix related bugs (#50731) 2022-06-23 15:13:39 -05:00
mute_timings_test.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
mute_timings.go Alerting: decouple api models from domain\dto models: separate Provenance status + converters (#63594) 2023-02-27 17:57:15 -05:00
notification_policies_test.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
notification_policies.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
persist_mock.go Plugins: Improve instrumentation by adding metrics and tracing (#61035) 2023-03-28 11:01:06 +02:00
persist.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
provisioning_store_mock.go Chore: Fix goimports grouping in alerting (#62424) 2023-01-30 09:55:35 +01:00
quota_checker_mock.go Chore: Fix goimports grouping in alerting (#62424) 2023-01-30 09:55:35 +01:00
templates_test.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00
templates.go Alerting: decouple api models from domain\dto models: separate Provenance status + converters (#63594) 2023-02-27 17:57:15 -05:00
testing.go Chore: Remove result fields from ngalert (#65410) 2023-03-28 10:34:35 +02:00