grafana/pkg/infra/httpclient/httpclientprovider
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
..
datasource_metrics_middleware_test.go Datasource: Shared HTTP client provider for core backend data sources and any data source using the data source proxy (#33439) 2021-05-19 23:53:41 +02:00
datasource_metrics_middleware.go datasource metrics: Correct help text for histograms (#50942) 2022-06-16 14:18:09 +02:00
forwarded_cookie_middleware_test.go Plugins: Refactor forward of cookies, OAuth token and header modifications by introducing client middlewares (#58132) 2022-12-01 19:08:36 +01:00
forwarded_cookies_middleware.go [main] Plugin fixes (#57399) 2022-10-21 13:54:55 +02:00
host_redirect_validation_middleware.go chore: move validations model into the validations service (#61953) 2023-01-23 15:10:14 -05:00
http_client_provider_test.go Plugins: Refactor forward of cookies, OAuth token and header modifications by introducing client middlewares (#58132) 2022-12-01 19:08:36 +01:00
http_client_provider.go Plugins: Add sql support for the secure socks proxy (#64630) 2023-03-16 06:54:19 -06:00
http_logger_middleware_test.go Plugins: Add support for HTTP logger (#46578) 2022-07-21 09:46:47 -04:00
http_logger_middleware.go Plugins: Add support for HTTP logger (#46578) 2022-07-21 09:46:47 -04:00
prometheus_metrics_middleware_test.go Plugins: Improve instrumentation by adding metrics and tracing (#61035) 2023-03-28 11:01:06 +02:00
prometheus_metrics_middleware.go Plugins: Improve instrumentation by adding metrics and tracing (#61035) 2023-03-28 11:01:06 +02:00
response_limit_middleware_test.go Handle ioutil deprecations (#53526) 2022-08-10 15:37:51 +02:00
response_limit_middleware.go DataProxy: Fix issue overriding response body when response status is 101 (#41364) 2021-11-09 14:33:54 +01:00
sigv4_middleware_test.go Auth: Guarantee consistency of signed SigV4 headers (#45054) 2022-02-08 14:48:17 +01:00
sigv4_middleware.go Auth: Guarantee consistency of signed SigV4 headers (#45054) 2022-02-08 14:48:17 +01:00
testing.go Handle ioutil deprecations (#53526) 2022-08-10 15:37:51 +02:00
tracing_middleware_test.go Tracing: Support multiple OTel propagators (#61199) 2023-03-27 14:56:24 -04:00
tracing_middleware.go Plugins: Improve instrumentation by adding metrics and tracing (#61035) 2023-03-28 11:01:06 +02:00
user_agent_middleware_test.go Plugins: Refactor forward of cookies, OAuth token and header modifications by introducing client middlewares (#58132) 2022-12-01 19:08:36 +01:00
user_agent_middleware.go Datasource: Shared HTTP client provider for core backend data sources and any data source using the data source proxy (#33439) 2021-05-19 23:53:41 +02:00