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

Prometheus exporter sanitize info metric #3572

Merged
merged 5 commits into from
Dec 15, 2023

Conversation

kornerc
Copy link
Contributor

@kornerc kornerc commented Dec 7, 2023

Description

The Prometheus Exporter did not sanitize the info metric.
This might prevent successful scraping from Prometheus when having, for example, dots in an attribute.

Fixes #3571 and #3563

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit test test_target_info_sanitize which checks if a character like a dot . in an attribute name is translated to an underscore _.

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

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

Copy link

linux-foundation-easycla bot commented Dec 7, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@kornerc kornerc marked this pull request as ready for review December 10, 2023 09:43
@kornerc kornerc requested a review from a team as a code owner December 10, 2023 09:43
@kornerc
Copy link
Contributor Author

kornerc commented Dec 10, 2023

PR is ready for review.

I think there is no need to update the documentation, nonetheless, I left in the checklist Documentation has been updated unchecked.

During the fix I found another issue in a test:


Parts of the test are not executed because result[:0] returns an empty list, instead it should be something like prometheus_metric = result[0].
But I guess it is better to make a separate issue and PR for this (I can do that).

@Jdsleppy
Copy link

@kornerc It looks like linting failed because black formatting was not applied. You can check this locally using

pip install tox==3.27.1
tox -e lint

To fix, you can use

pip install -r dev-requirements.txt
python -m black .

I'm now looking into the other CI failure to see how to fix it.

@Jdsleppy
Copy link

@kornerc It seems like the only other error was unrelated:

ERROR:   py37-test-instrumentation-falcon3: commands failed

So we can probably get this reviewed after linting is fixed.

@aabmass
Copy link
Member

aabmass commented Dec 14, 2023

Thanks for the PR!

@kornerc
Copy link
Contributor Author

kornerc commented Dec 14, 2023

@kornerc It looks like linting failed because black formatting was not applied. You can check this locally using

pip install tox==3.27.1
tox -e lint

To fix, you can use

pip install -r dev-requirements.txt
python -m black .

I'm now looking into the other CI failure to see how to fix it.

@Jdsleppy thanks for the feedback and the info!

In 170647e I reformattet the code and tox -e lint does not complain anymore about the formatting.

@ocelotl ocelotl merged commit b7e1888 into open-telemetry:main Dec 15, 2023
111 checks passed
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.

Prometheus metric target_info with SERVICE_NAME contains a dot
4 participants