Skip to content

Use containsPointsSatisfying in metric assertions#18263

Merged
trask merged 6 commits into
open-telemetry:mainfrom
trask:use-contains-points-satisfying
May 11, 2026
Merged

Use containsPointsSatisfying in metric assertions#18263
trask merged 6 commits into
open-telemetry:mainfrom
trask:use-contains-points-satisfying

Conversation

@trask
Copy link
Copy Markdown
Member

@trask trask commented Apr 24, 2026

Using convenience API introduced in open-telemetry/opentelemetry-java#8329

@trask trask mentioned this pull request May 5, 2026
@trask trask marked this pull request as ready for review May 11, 2026 03:01
@trask trask requested a review from a team as a code owner May 11, 2026 03:01
Copilot AI review requested due to automatic review settings May 11, 2026 03:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates metric assertion style in tests to use the newer OpenTelemetry AssertJ convenience APIs (notably hasLongSumSatisfying(...) and containsPointsSatisfying(...)) introduced upstream, simplifying point matching and removing direct MetricData point iteration.

Changes:

  • Refactor runtime-telemetry memory metric tests to assert long-sum data via hasLongSumSatisfying(...) and validate expected points via containsPointsSatisfying(...).
  • Simplify metaspace/code-cache metric tests by replacing manual anyMatch(...) checks with point-level assertion lambdas.
  • Update a Pulsar metric test to use containsPointsSatisfying(...) for matching a specific messaging.receive.messages point.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
instrumentation/runtime-telemetry/library/src/testJava17/java/io/opentelemetry/instrumentation/runtimetelemetry/PsGcMemoryMetricTest.java Switch memory metric assertions to hasLongSumSatisfying and point-based checks via containsPointsSatisfying.
instrumentation/runtime-telemetry/library/src/testJava17/java/io/opentelemetry/instrumentation/runtimetelemetry/MetaspaceMemoryUsageMetricTest.java Replace manual point iteration with hasLongSumSatisfying + containsPointsSatisfying.
instrumentation/runtime-telemetry/library/src/testJava17/java/io/opentelemetry/instrumentation/runtimetelemetry/MetaspaceMemoryLimitMetricTest.java Replace manual point iteration with hasLongSumSatisfying + containsPointsSatisfying.
instrumentation/runtime-telemetry/library/src/testJava17/java/io/opentelemetry/instrumentation/runtimetelemetry/MetaspaceMemoryCommittedMetricTest.java Replace manual point iteration with hasLongSumSatisfying + containsPointsSatisfying.
instrumentation/runtime-telemetry/library/src/testJava17/java/io/opentelemetry/instrumentation/runtimetelemetry/G1GcMemoryMetricTest.java Use hasLongSumSatisfying and containsPointsSatisfying for expected pool points.
instrumentation/runtime-telemetry/library/src/testJava17/java/io/opentelemetry/instrumentation/runtimetelemetry/CodeCacheMemoryInitMetricTest.java Convert value/attribute anyMatch into point-level assertions using containsPointsSatisfying.
instrumentation/pulsar/pulsar-2.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/pulsar/v2_8/PulsarClientTest.java Update a messaging.receive.messages assertion to use containsPointsSatisfying for matching the batch receive count point.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@trask trask merged commit 178530b into open-telemetry:main May 11, 2026
93 checks passed
@trask trask deleted the use-contains-points-satisfying branch May 11, 2026 14:45
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.

3 participants