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

Limit prometheus exemplar labels #6791

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

harshitrjpt
Copy link

@harshitrjpt harshitrjpt commented Oct 15, 2024

Changes done:

  1. create exemplar's labels object before creating the exemplar object. (deduplicated some code there)
  2. calculate labels length or runes.
  3. compare label runes with the hardcoded max rune. If limit reached, then return null exemplar obj.
  4. Added tests with sample LongSum metric data consisting exemplar for scenarios
    a) exemplar labels below max rune
    b) exemplar labels above max rune
> Task :exporters:prometheus:test

Otel2PrometheusConverterTest > exemplarLabelsAboveLimit() STANDARD_ERROR
    [Test worker] WARN io.opentelemetry.exporter.prometheus.Otel2PrometheusConverter - exemplar labels have 193 unicode code points, exceeding the limit of 128

@harshitrjpt harshitrjpt requested a review from a team as a code owner October 15, 2024 07:57
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.39%. Comparing base (537f5c4) to head (55a1bac).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
.../exporter/prometheus/Otel2PrometheusConverter.java 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6791      +/-   ##
============================================
+ Coverage     90.11%   90.39%   +0.27%     
- Complexity     6545     6580      +35     
============================================
  Files           728      731       +3     
  Lines         19702    19723      +21     
  Branches       1935     1928       -7     
============================================
+ Hits          17755    17829      +74     
+ Misses         1347     1297      -50     
+ Partials        600      597       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@harshitrjpt
Copy link
Author

Any clue why in 'markdown-link-check' job following links are failing:

  [✖] https://maven-badges.herokuapp.com/maven-central/io.opentelemetry/opentelemetry-api → Status: 503
  [✖] https://maven-badges.herokuapp.com/maven-central/io.opentelemetry/opentelemetry-api/badge.svg → Status: 503

How can we fix this?

@laurit
Copy link
Contributor

laurit commented Oct 17, 2024

Any clue why in 'markdown-link-check' job following links are failing:

  [✖] https://maven-badges.herokuapp.com/maven-central/io.opentelemetry/opentelemetry-api → Status: 503
  [✖] https://maven-badges.herokuapp.com/maven-central/io.opentelemetry/opentelemetry-api/badge.svg → Status: 503

How can we fix this?

Seems to be fixed now.

Level.WARNING,
"exemplar labels have "
+ codePoints
+ " codePoints, exceeding the limit of "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd replace codePoints with unicode code points to make it easier to understand what this warning means

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laurit addressed.

Task :exporters:prometheus:test

Otel2PrometheusConverterTest > exemplarLabelsAboveLimit() STANDARD_ERROR
    [Test worker] WARN io.opentelemetry.exporter.prometheus.Otel2PrometheusConverter - exemplar labels have 193 unicode code points, exceeding the limit of 128


private static int getCodePoints(Labels labels) {
int codePoints = 0;
for (Label l : labels) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strongly suggest you rename l -> label. Otherwise it looks like the number '1'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkwatson i don't think it's a big deal as the loop is too small, but i suppose it does help in quicker reading. I addressed it in latest commit.

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.

3 participants