feat(sensor): Add sensor-scanner config info metrics#19392
feat(sensor): Add sensor-scanner config info metrics#19392
Conversation
Expose static Sensor metrics that describe intended scanner mode and image indexing route (cluster-local vs non-cluster-local), so investigators can infer scanner setup without relying on startup logs. Also refresh values on Central capability handshake and cover mode permutations with unit tests. AI-assisted: I generated the metric wiring, lifecycle hook, and tests; you defined/refined the metric semantics, naming, and help-text intent in review.
|
This change is part of the following stack: Change managed by git-spice. |
|
Skipping CI for Draft Pull Request. |
|
Images are ready for the commit at 4454c8b. To use with deploy scripts, first |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19392 +/- ##
========================================
Coverage 49.68% 49.68%
========================================
Files 2700 2701 +1
Lines 203278 203392 +114
========================================
+ Hits 100999 101063 +64
- Misses 94753 94806 +53
+ Partials 7526 7523 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Calling
UpdateScannerConfigurationInfo()frominit()means the initial metric values are computed before Central capabilities are known, soscannerModewill always start asv2; consider only updating after capabilities are set (or documenting this behavior) to avoid a briefly misleading topology view after startup. UpdateScannerConfigurationInfo()relies onReset()on registeredGaugeVecs, which can be problematic under concurrent collection; consider avoidingReset()and instead explicitly setting only the desired label combinations (e.g., ensure a singleWith(...).Set(1)per info timeseries and no others) to make the update operation safer and more predictable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Calling `UpdateScannerConfigurationInfo()` from `init()` means the initial metric values are computed before Central capabilities are known, so `scannerMode` will always start as `v2`; consider only updating after capabilities are set (or documenting this behavior) to avoid a briefly misleading topology view after startup.
- `UpdateScannerConfigurationInfo()` relies on `Reset()` on registered `GaugeVec`s, which can be problematic under concurrent collection; consider avoiding `Reset()` and instead explicitly setting only the desired label combinations (e.g., ensure a single `With(...).Set(1)` per info timeseries and no others) to make the update operation safer and more predictable.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Description
Add Sensor info metrics that make scanner topology immediately visible from metrics, without depending on startup logs:
rox_sensor_scanner_configuration_info{local,mode,delegated} 1rox_sensor_image_indexing_route_info{for_images,indexer} 1What this solves:
v2/v4mode, whether delegated scanning is enabled, and what indexing route is intended forcluster_localvsnon_cluster_localimages.User-facing documentation
Testing and quality
Automated testing
How I validated my change