Skip to content

Fix LongExemplarAssert hasFilteredAttributesSatisfyingExactly to enforce exact attribute matching#8518

Merged
jack-berg merged 2 commits into
open-telemetry:mainfrom
thswlsqls:fix/long-exemplar-assert-filtered-attributes-exactly
Jul 13, 2026
Merged

Fix LongExemplarAssert hasFilteredAttributesSatisfyingExactly to enforce exact attribute matching#8518
jack-berg merged 2 commits into
open-telemetry:mainfrom
thswlsqls:fix/long-exemplar-assert-filtered-attributes-exactly

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

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
thswlsqls force-pushed the fix/long-exemplar-assert-filtered-attributes-exactly branch from cdf0841 to d95bcba Compare June 22, 2026 08:27
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.61%. Comparing base (c5c9d87) to head (7bcf1d0).
⚠️ 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     

☔ View full report in Codecov by Harness.
📢 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.

@jack-berg jack-berg added the needs author feedback Waiting for additional feedback from the author label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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 github-actions Bot added the Stale label Jul 9, 2026
@jack-berg
jack-berg marked this pull request as ready for review July 13, 2026 20:32
@jack-berg
jack-berg requested a review from a team as a code owner July 13, 2026 20:32
@github-actions github-actions Bot removed the Stale label Jul 13, 2026
@jack-berg
jack-berg merged commit cbc97c4 into open-telemetry:main Jul 13, 2026
29 checks passed
@otelbot

otelbot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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.

@thswlsqls
thswlsqls deleted the fix/long-exemplar-assert-filtered-attributes-exactly branch July 17, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs author feedback Waiting for additional feedback from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LongExemplarAssert.hasFilteredAttributesSatisfyingExactly does not enforce exact matching

2 participants