Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Add Support for Exposing userLabels from GCP Resources as Prometheus Labels #390

Open
elenaknofs opened this issue Nov 19, 2024 · 0 comments

Comments

@elenaknofs
Copy link

We would like to request support for exposing userLabels from Google Cloud resources (e.g., Compute Engine, Cloud SQL) as Prometheus metric labels in the Google Stackdriver Prometheus Exporter.

Currently, while the exporter successfully maps Stackdriver metrics and their associated resource labels to Prometheus, custom userLabels defined on resources in Google Cloud are not included. These labels are essential for enabling dynamic filtering, categorization, and fine-grained alerting in Prometheus.

Adding support for userLabels would improve the usability of the exporter by aligning it with real-world use cases where custom metadata is used to manage metrics across complex environments.

Use Case

In environments with a large number of Google Cloud resources, userLabels are commonly used to define metadata such as:

  • Maintenance states (monitoring=true/false)
  • Environment information (env=prod, env=stage)
  • Resource ownership (team=devops, team=dba)
    Including userLabels in the exported metrics would allow users to:
  1. Dynamically filter metrics based on userLabels in Prometheus queries.
  2. Set up targeted alerts for resources with specific labels (e.g., suppress alerts for resources with monitoring=false).
  3. Enhance observability by grouping metrics using custom tags.

Implementation Details

  • Extend the exporter’s logic to fetch userLabels from the resource.labels field for each monitored resource.
  • Map the userLabels to Prometheus metric labels during metric export.
  • Allow users to optionally enable or disable userLabels in the exported metrics via a command-line flag (e.g., --include-user-labels).

More info about GCP resource labeling can be found here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant