Skip to content

feat(exporter-prometheus): support withoutScopeInfo option#5993

Merged
pichlermarc merged 2 commits intoopen-telemetry:mainfrom
cjihrig:prom-scope-info
Nov 7, 2025
Merged

feat(exporter-prometheus): support withoutScopeInfo option#5993
pichlermarc merged 2 commits intoopen-telemetry:mainfrom
cjihrig:prom-scope-info

Conversation

@cjihrig
Copy link
Copy Markdown
Contributor

@cjihrig cjihrig commented Oct 8, 2025

Which problem is this PR solving?

This commit adds support for the without_scope_info option (converted to camelCase to match other options) from the spec.

Fixes # N/A

Related: Here are some output snapshots from the Golang library which include the scope labels.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Existing and new tests.

Checklist:

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

@cjihrig cjihrig requested a review from a team as a code owner October 8, 2025 11:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 8, 2025

Codecov Report

❌ Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.16%. Comparing base (e460f03) to head (fcb2aa0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ry-exporter-prometheus/src/PrometheusSerializer.ts 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5993      +/-   ##
==========================================
- Coverage   95.16%   95.16%   -0.01%     
==========================================
  Files         316      316              
  Lines        9207     9220      +13     
  Branches     2075     2080       +5     
==========================================
+ Hits         8762     8774      +12     
- Misses        445      446       +1     
Files with missing lines Coverage Δ
...etry-exporter-prometheus/src/PrometheusExporter.ts 96.70% <100.00%> (+0.07%) ⬆️
...ry-exporter-prometheus/src/PrometheusSerializer.ts 95.83% <95.00%> (-0.35%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cjihrig
Copy link
Copy Markdown
Contributor Author

cjihrig commented Oct 23, 2025

@pichlermarc would you mind taking a look?

@cjihrig
Copy link
Copy Markdown
Contributor Author

cjihrig commented Oct 24, 2025

The Windows test failure appears to be a flake - #6042

@cjihrig
Copy link
Copy Markdown
Contributor Author

cjihrig commented Oct 29, 2025

Maybe @david-luna could take a look?

@trentm
Copy link
Copy Markdown
Contributor

trentm commented Oct 29, 2025

@cjihrig Are you able to provide some background for a reviewer that might not be so familiar with Prometheus, or exactly what references you mean by "from the spec.".

I clicked through to open-telemetry/opentelemetry-specification#4223 (comment) but am not sure if that is the best reference here.

@cjihrig
Copy link
Copy Markdown
Contributor Author

cjihrig commented Oct 29, 2025

Sure @trentm. I was looking at this page. Apologies if that shouldn't be referred to as the spec, but I assumed it was based on the "specs" in the URL. From that page, I was referring to:

A Prometheus Exporter MAY support a configuration option to produce metrics without scope labels. The option MAY be named without_scope_info, and MUST be false by default.

I changed the name from snake_case to camelCase to match the other options used in the JS repo.

Looking at the test data from the Golang repo, you can see examples like this one (or most of the other examples in that directory). Note the otel_scope_* labels. Then, look at this example, which disables the scope labels. That example does not contain the otel_scope_* labels.

Copy link
Copy Markdown
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

sorry for the delay on this PR - looks good overall, just one question.

This commit adds support for the without_scope_info option
(converted to camelCase to match other options) from the spec.
Copy link
Copy Markdown
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

thanks!

@pichlermarc pichlermarc added this pull request to the merge queue Nov 7, 2025
Merged via the queue into open-telemetry:main with commit 320d045 Nov 7, 2025
27 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Nov 7, 2025

Thank you for your contribution @cjihrig! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants