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

feat(exporter-prometheus): add additional attributes option #5317

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marius-a-mueller
Copy link

@marius-a-mueller marius-a-mueller commented Jan 10, 2025

Which problem is this PR solving?

At the moment there is no way to set default/static attributes for all metrics that are being exported by the Prometheus exporter. This PR adds an option for adding resource attributes as metric attributes.

Fixes # (issue)

Short description of the changes

  • add withResourceConstantLabels option to ExporterConfig
  • use regex pattern to choose which resource attributes will be added as metric attributes
  • use already implemented logic for additional attributes
  • add unit tests

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • unit tests with npm test

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@marius-a-mueller marius-a-mueller requested a review from a team as a code owner January 10, 2025 14:57
Copy link

linux-foundation-easycla bot commented Jan 10, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: marius-a-mueller / name: Marius Müller (a36a818)

@marius-a-mueller marius-a-mueller marked this pull request as draft January 10, 2025 15:04
@pichlermarc
Copy link
Member

@pichlermarc
Copy link
Member

The way the specification suggests to handle this is more closely aligned with OTel concepts and would also solve #5073

@marius-a-mueller marius-a-mueller force-pushed the feature/add_additional_attributes_to_prometheus_exporter branch from bdd99a6 to bd68f6b Compare January 13, 2025 16:31
@marius-a-mueller marius-a-mueller marked this pull request as ready for review January 13, 2025 16:33
@marius-a-mueller
Copy link
Author

Okay, I implemented the feature as written in the specification. I just need a bit longer for the CLA authorization.

@marius-a-mueller marius-a-mueller force-pushed the feature/add_additional_attributes_to_prometheus_exporter branch from bd68f6b to a36a818 Compare January 15, 2025 14:50
@marius-a-mueller
Copy link
Author

And now I have the CLA authorization too.

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

Successfully merging this pull request may close these issues.

2 participants