opentelemetry-java icon indicating copy to clipboard operation
opentelemetry-java copied to clipboard

Fix LongExemplarAssert hasFilteredAttributesSatisfyingExactly to enforce exact attribute matching

Open thswlsqls opened this issue 5 months ago • 1 comments

Fixes #8517

Description

  • LongExemplarAssert.hasFilteredAttributesSatisfyingExactly(AttributeAssertion...) delegated to hasFilteredAttributesSatisfying (the non-exact helper), so it did not reject extra filtered attributes.
  • It now delegates to the exact Iterable overload (AssertUtil.assertAttributesExactly), matching DoubleExemplarAssert.hasFilteredAttributesSatisfyingExactly and the same-class Iterable overload.
  • Present since 1.21.0; existing longGaugeFailure cases threw for other reasons and never exercised the exactness path.

Testing done

  • Added a negative case to MetricAssertionsTest.longGaugeFailure asserting a single filtered attribute on an exemplar that has nine; it must raise AssertionError. Fails before the fix, passes after.
  • ./gradlew :sdk:testing:check — passed (16 tests in MetricAssertionsTest).
  • No public API change: method signature is unchanged, so no docs/apidiffs update.
  • Added a ## Unreleased #### Testing entry in CHANGELOG.md (assertion now stricter; previously lax tests may newly fail).

thswlsqls avatar Jun 22 '26 08:06 thswlsqls

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 91.61%. Comparing base (c5c9d87) to head (7bcf1d0). :warning: Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8518      +/-   ##
============================================
+ Coverage     91.60%   91.61%   +0.01%     
- Complexity    10312    10313       +1     
============================================
  Files          1013     1013              
  Lines         27274    27274              
  Branches       3202     3202              
============================================
+ Hits          24983    24986       +3     
+ Misses         1563     1561       -2     
+ Partials        728      727       -1     

:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Jun 22 '26 08:06 codecov[bot]

This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

github-actions[bot] avatar Jul 09 '26 18:07 github-actions[bot]

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

otelbot[bot] avatar Jul 13 '26 20:07 otelbot[bot]