Skip to content

Add typed metric assertion helpers - #20767

Closed
trask with Copilot wants to merge 4 commits into
copilot/implement-histogram-points-helperfrom
copilot/extend-histogram-to-other-metric-types
Closed

trask with Copilot wants to merge 4 commits into
copilot/implement-histogram-points-helperfrom
copilot/extend-histogram-to-other-metric-types

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Extend the composable histogram assertion pattern to long/double sums and gauges, exponential histograms, and summaries, then migrate existing test assertions to the flat helper form.

testing.waitAndAssertMetrics(
    INSTRUMENTATION_NAME,
    longSum(
        metric -> metric.hasName("requests").hasUnit("{request}"),
        point -> point.hasValue(1)));

The migration preserves metric metadata, point expectations, aggregation checks, and existing collection-matching behavior. No production telemetry changes.

Stacked on #20741.

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-20 18:17 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Copilot AI changed the title [WIP] Extend histogram() to support other metric types Add typed metric assertion helpers Oct 20, 2026
Copilot AI requested a review from trask October 20, 2026 18:30
@trask
trask requested a balanced review from Copilot October 20, 2026 18:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The additions consistently follow the existing assertion pattern, with focused coverage and no identified blocking issues.

No open issues 🎉

What changed in this PR

Extends the composable histogram assertion pattern from #20741 to six additional metric types in testing-common.

Changes:

  • Adds typed helpers for long/double sums and gauges, exponential histograms, and summaries.
  • Tests metadata, unordered point matching, extra-point rejection, and incompatible-type rejection.
File Description
testing-common/​src/​test/​java/​io/​opentelemetry/​instrumentation/​testing/​InstrumentationTestRunnerTest.java Adds helper coverage and metric fixtures.
testing-common/​src/​main/​java/​io/​opentelemetry/​instrumentation/​testing/​util/​MetricAssertions.java Adds six composable typed assertion helpers.

Review effort: Balanced

Copilot stopped work on behalf of trask due to an error October 20, 2026 20:01
Copilot AI requested a review from trask October 20, 2026 20:01
Copilot AI and others added 4 commits October 20, 2026 19:07
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
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