telemetry: move geoprobe-agent metrics into geoprobe package#3526
Merged
telemetry: move geoprobe-agent metrics into geoprobe package#3526
Conversation
5 tasks
ben-dz
requested changes
Apr 13, 2026
Contributor
ben-dz
left a comment
There was a problem hiding this comment.
The new constant label is named device_pubkey, but the geoprobe-agent runs on geoprobe servers, not on DZDs/devices. The value passed is geoProbePubkey.String() — that's a geoprobe pubkey, not a device pubkey. This will cause confusion in PromQL queries and dashboards. Should probably be geoprobe_pubkey or just pubkey.
NewMetrics() is called unconditionally at
, before the if *metricsEnable check. All 12 collectors get registered to prometheus.DefaultRegisterer even if no HTTP server is started to serve them. Not a regression (promauto did the same), but might want to fix it.
ben-dz
approved these changes
Apr 15, 2026
4188b91 to
f5df9dd
Compare
Move metrics from the shared metrics package into a Metrics struct in the geoprobe package. This replaces package-level promauto globals with explicit dependency injection, adds source/device_pubkey constant labels, and shortens metric names (doublezero_geoprobe_* instead of doublezero_device_geoprobe_agent_*).
The constant label identifies the geoprobe device, not a generic device. Rename for clarity and fix gofmt alignment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f5df9dd to
510a617
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3432
Summary
internal/metricspackage into aMetricsstruct ininternal/geoprobe, replacing package-levelpromautoglobals with explicit dependency injection viaNewMetrics()sourceanddevice_pubkeyconstant labels to all geoprobe metrics, enabling per-device filtering in dashboardsdoublezero_device_geoprobe_agent_*todoublezero_geoprobe_*geolocation_metrics.gofrom the shared metrics packageLines of Code
geoprobe/metrics.gogeoprobe/metrics_test.gogeoprobe-agent/main.gometrics/geolocation_metrics.goTesting Verification
offsetCachetests ingeoprobe-agentcontinue to pass unchangedgo vetclean across the telemetry module