PMM-15228 Enrich AuthServer with performance metrics#5658
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5658 +/- ##
==========================================
- Coverage 43.59% 42.44% -1.15%
==========================================
Files 415 431 +16
Lines 43134 34925 -8209
Branches 0 591 +591
==========================================
- Hits 18804 14824 -3980
+ Misses 22454 18675 -3779
+ Partials 1876 1426 -450
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds Prometheus observability to the Grafana AuthServer in pmm-managed, exposing request/cache/latency metrics and wiring the server into the Prometheus registry, plus updating the PMM Health Grafana dashboard to visualize the new signals.
Changes:
- Implemented a custom Prometheus collector in
AuthServerwith counters/gauges/histograms for auth requests, Grafana calls, cache behavior, in-flight requests, and latencies. - Registered the
AuthServercollector during pmm-managed startup so metrics are exposed automatically. - Updated the PMM Health dashboard to include panels for the new auth metrics and additional runtime/health visualizations.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| managed/services/grafana/auth_server.go | Adds Prometheus metric descriptors/state, implements prometheus.Collector, and instruments key auth/cache/DB/Grafana code paths. |
| managed/cmd/pmm-managed/main.go | Registers the AuthServer as a Prometheus collector at startup. |
| dashboards/dashboards/PMM Health/PMM_Health.json | Adds/adjusts dashboard panels and queries to surface new auth metrics and runtime health info. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Ticket number: PMM-15228
Percona-Lab/pmm-submodules#4481
This pull request introduces comprehensive Prometheus metrics to the
AuthServerin the Grafana authentication service, enabling detailed monitoring of authentication requests, cache performance, and latency. The changes include metric definitions, collection, and registration, as well as instrumentation of key code paths to increment relevant counters and histograms.Prometheus Metrics Integration:
Added Prometheus metric fields and descriptors to the
AuthServerstruct, including counters for authentication requests, cache hits/misses, in-flight requests, and latency histograms. Implemented theprom.Collectorinterface withDescribeandCollectmethods. [1] [2]Instrumented the main authentication flow (
ServeHTTP,getLBACFilters,getAuthUser,retrieveRole) to increment metrics for request counts, cache hits/misses, in-flight requests, and operation durations. [1] [2] [3] [4] [5] [6] [7]Application Integration:
AuthServeras a Prometheus collector in the main application entrypoint to ensure metrics are exposed.Dependency and Import Updates:
Other Minor Improvements:
These enhancements provide greater observability into authentication performance and reliability, supporting future troubleshooting and scaling efforts.