Skip to content

feat: Implement scope_info_enabled#3503

Merged
cijothomas merged 6 commits into
open-telemetry:mainfrom
ArthurSens:prometheus-scope-labels
Jun 10, 2026
Merged

feat: Implement scope_info_enabled#3503
cijothomas merged 6 commits into
open-telemetry:mainfrom
ArthurSens:prometheus-scope-labels

Conversation

@ArthurSens

@ArthurSens ArthurSens commented May 7, 2026

Copy link
Copy Markdown
Member

Related to #3474, but entirely focused on the implementation of Instrumentation Scope.

Here I'm doing quite a few things:

Disclosure: Although I've done Rust before, I'm not great at it. I do rely on LLMs to write most of the code.

Changes

Please provide a brief description of the changes here.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens requested a review from a team as a code owner May 7, 2026 18:52
@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.8%. Comparing base (f744509) to head (7892625).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-prometheus/src/lib.rs 0.0% 36 Missing ⚠️
opentelemetry-prometheus/src/config.rs 0.0% 19 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3503     +/-   ##
=======================================
- Coverage   82.8%   82.8%   -0.1%     
=======================================
  Files        130     130             
  Lines      27276   27284      +8     
=======================================
- Hits       22609   22608      -1     
- Misses      4667    4676      +9     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread opentelemetry-prometheus/src/config.rs
Comment thread opentelemetry-prometheus/src/config.rs Outdated
Comment thread opentelemetry-prometheus/Cargo.toml Outdated
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! This PR has been automatically marked as stale because it has not had activity in the last 14 days. This may be due to a delay in review on our side or awaiting a response from you; either is fine, and we appreciate your patience.

It will be closed in 14 days if no further activity occurs. Pushing a new commit or leaving a comment will remove the stale label and keep the PR open.

@github-actions github-actions Bot added the Stale label May 22, 2026
@ArthurSens

Copy link
Copy Markdown
Member Author

not stale, just waiting for reviews

@github-actions github-actions Bot removed the Stale label May 23, 2026
@ArthurSens

Copy link
Copy Markdown
Member Author

hey @cijothomas, checking in here, anything I could do to move this forward?

Comment thread opentelemetry-prometheus/src/lib.rs Outdated
@cijothomas

Copy link
Copy Markdown
Member

@ArthurSens Left few inline comments, nothing major. Please address them, and I'll do a final approaal and merge.

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens changed the title Implement scope_info_enabled featImplement scope_info_enabled Jun 8, 2026
@ArthurSens ArthurSens changed the title featImplement scope_info_enabled feat: Implement scope_info_enabled Jun 8, 2026
Comment thread opentelemetry-prometheus/CHANGELOG.md Outdated
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Comment thread opentelemetry-prometheus/CHANGELOG.md Outdated

@cijothomas cijothomas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, just want another nit fix on changelog and good to go.

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
let mut attr_labels = BTreeMap::<String, Vec<String>>::new();
for kv in scope.attributes() {
let label_name = utils::sanitize_prom_kv(&format!("{SCOPE_ATTRIBUTE_PREFIX}{}", kv.key));
if RESERVED_SCOPE_LABELS.contains(&label_name.as_str()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good for followup - we can check if the attribute is one of name/version/schema_url before allocating the label_name by invoking format.

res
}

fn get_scope_labels(scope: &InstrumentationScope) -> Vec<LabelPair> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

existing bug - I don't think we are handling the collision when scope_name (etc.) and metric attributes are same. Just noting , not blocker for this PR but a good follow up.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Interesting, I have never seen a metric attribute with the otel_scope_* prefix, but I guess indeed that's possible

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the spec calls out this possibility and tells us what to do. We need to follow that. (of course in a future PR)

@cijothomas cijothomas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@cijothomas cijothomas added this pull request to the merge queue Jun 10, 2026
Merged via the queue into open-telemetry:main with commit 8a2067c Jun 10, 2026
25 of 26 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.

2 participants