Skip to content

Fix LongExemplarAssert hasFilteredAttributesSatisfyingExactly to enforce exact attribute matching#8518

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/long-exemplar-assert-filtered-attributes-exactly
Draft

Fix LongExemplarAssert hasFilteredAttributesSatisfyingExactly to enforce exact attribute matching#8518
thswlsqls wants to merge 1 commit 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 78.79%. Comparing base (824334c) to head (d95bcba).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8518      +/-   ##
============================================
+ Coverage     78.77%   78.79%   +0.02%     
- Complexity     8579     8581       +2     
============================================
  Files          1009     1009              
  Lines         28993    28993              
  Branches       3599     3599              
============================================
+ Hits          22839    22845       +6     
+ Misses         5311     5306       -5     
+ Partials        843      842       -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.

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.

LongExemplarAssert.hasFilteredAttributesSatisfyingExactly does not enforce exact matching

1 participant