feat: Add metric aggregation configuration for hydrating system_labels#443
feat: Add metric aggregation configuration for hydrating system_labels#443adityastic wants to merge 1 commit intoprometheus-community:masterfrom
Conversation
|
@SuperQ mind giving it a review! Thanks! |
|
@adityastic Thank you for this! Would it be possible to grab the user defined labels as part of this PR as well? 🙏 https://cloud.google.com/monitoring/api/ref_v3/rest/v3/TimeSeries#MonitoredResourceMetadata |
|
👋 @adityastic is this something that requires all the extra configuration for system_labels? Looking at the docs, https://cloud.google.com/monitoring/alerts/doc-variables#null-values, it seems as though the requirement is that the system labels be used in a filter. Could someone configure the system labels they want directly and we tack on a I think we could have a separate conversation regarding introducing support for aggregations/reduce configuration. If we go forward with the current implementation I don't see many people being able to take advantage of system_labels due to the complexity required to configure their support. I would very much like to see a scrape result from your example config to see how the metrics types and names are treated. Applying any of the reduce functions seems like it would dramatically change the context of the metric but that won't be reflected in the metric name. |
After some experimenting on my end adding a filter on metada.system_labels does not work out of the box, as the data needs to be aggregated/aligned... I got this error on my end with a basic filter |
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-aggregationsflagmetadata in exported metrics
reducer, group-by fields, and per-series aligner configuration
Technical Implementation:
MetricAggregationConfigstruct to handle aggregation configurationConfiguration Format:
The new aggregation configuration uses the format:
metric_name:alignment_period:cross_series_reducer:group_by_fields:per_series_alignerExample 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_MEANUse 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: