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

test: Add Scope attributes test cases for metrics #2736

Merged

Conversation

Shunpoco
Copy link
Contributor

@Shunpoco Shunpoco commented Mar 2, 2025

Fixes #2702

Changes

Add additional unit test to cover Scope attributes for metrics.
I don't add any test cases for Logger/Tracer because their with_scope() method creates new Logger/Tracer regardless of Scope attribute's identity (Will we change the methods in the future?).

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)

@Shunpoco Shunpoco changed the title [WIP] Issue 2702 add scope attributes test [WIP] Add Scope attributes test cases for metrics Mar 2, 2025
Copy link

codecov bot commented Mar 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.4%. Comparing base (1583e70) to head (d2f7f2b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2736   +/-   ##
=====================================
  Coverage   79.4%   79.4%           
=====================================
  Files        123     123           
  Lines      22736   22770   +34     
=====================================
+ Hits       18058   18093   +35     
+ Misses      4678    4677    -1     

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

Shunpoco added 3 commits March 2, 2025 14:07
InstrumentationScope ignores the order of attributes, so they are identical.

Signed-off-by: Shunpoco <[email protected]>
This test checks if meter_provider provides different meters when each call has different scope attributes.

Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
@Shunpoco Shunpoco force-pushed the issue-2702-add-scope-attributes-test branch from ba1afd0 to b051d15 Compare March 2, 2025 14:07
@Shunpoco Shunpoco changed the title [WIP] Add Scope attributes test cases for metrics Add Scope attributes test cases for metrics Mar 2, 2025
@Shunpoco Shunpoco changed the title Add Scope attributes test cases for metrics test: Add Scope attributes test cases for metrics Mar 2, 2025
@Shunpoco Shunpoco marked this pull request as ready for review March 2, 2025 15:01
@Shunpoco Shunpoco requested a review from a team as a code owner March 2, 2025 15:01
@cijothomas
Copy link
Member

I don't add any test cases for Logger/Tracer because their with_scope() method creates new Logger/Tracer regardless of Scope attribute's identity (Will we change the methods in the future?).

Not likely to change as it is not required. For Metrics this is important to get pre-aggregation correctly

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Thanks!

@cijothomas cijothomas merged commit 13fafcb into open-telemetry:main Mar 2, 2025
23 checks passed
@Shunpoco Shunpoco deleted the issue-2702-add-scope-attributes-test branch March 2, 2025 20:53
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.

Extend test coverage for Scope attributes
2 participants