feat: Add metric aggregation configuration for hydrating system_labels #443
+493
−19
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.
This PR takes over #416
This commit addresses the need to access GCP Monitoring's system_labels metadata
(like machine_type) which are not returned by default through the APIs. By adding
support for metric aggregation configuration, users can now explicitly instruct
the API to include system labels in the response.
Related issues which could use this feature:
Changes:
are not returned by default through the APIs
New Features:
options per metric prefix using
--monitoring.metrics-with-aggregations
flagmetadata in exported metrics
reducer, group-by fields, and per-series aligner configuration
Technical Implementation:
MetricAggregationConfig
struct to handle aggregation configurationConfiguration Format:
The new aggregation configuration uses the format:
metric_name:alignment_period:cross_series_reducer:group_by_fields:per_series_aligner
Example for machine_type access:
compute.googleapis.com/reservation/used:60s:REDUCE_SUM:resource.label."resource_container",resource.label."location",resource.label."reservation_id",metadata.system_labels."machine_type",metric.label."reserved_resource_type":ALIGN_MEAN
Use Case Example:
To expose machine_type dimension for reservation metrics:
--monitoring.metrics-with-aggregations="compute.googleapis.com/reservation/used:60s:REDUCE_SUM:resource.label.\"resource_container\",resource.label.\"location\",resource.label.\"reservation_id\",metadata.system_labels.\"machine_type\",metric.label.\"reserved_resource_type\":ALIGN_MEAN"
Documentation: