Skip to content

Add AssertTimerMetrics helper function to metricstest package#7893

Merged
yurishkuro merged 2 commits intojaegertracing:mainfrom
JaeguKim:assert-timer-mertrics
Jan 29, 2026
Merged

Add AssertTimerMetrics helper function to metricstest package#7893
yurishkuro merged 2 commits intojaegertracing:mainfrom
JaeguKim:assert-timer-mertrics

Conversation

@JaeguKim
Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

Description of the changes

  • Add ExpectedTimerMetric struct with Name, Tags, Percentile, and Value fields
  • Add AssertTimerMetrics helper function to metricstest package for validating timer metrics with percentile values
  • Replace hardcoded metric key strings in observer_test.go with the new AssertTimerMetrics API
  • Remove unused assert import from observer_test.go

How was this change tested?

  • Added TestAssertTimerMetrics unit test in metricstest_test.go
  • Verified existing tests pass: go test ./internal/metricstest/... ./examples/hotrod/pkg/tracing/rpcmetrics/...

Checklist

Signed-off-by: JaeguKim <rlaworn1993@gmail.com>
@JaeguKim JaeguKim requested a review from a team as a code owner January 17, 2026 03:36
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 adds helper functionality for asserting timer metrics with percentile values in the metricstest package. The change simplifies test code by replacing manual metric key construction and assertion with a more ergonomic API.

Changes:

  • Added ExpectedTimerMetric struct and AssertTimerMetrics function to the metricstest package
  • Replaced hardcoded metric key strings in observer_test.go with the new AssertTimerMetrics API
  • Added unit test coverage for the new AssertTimerMetrics functionality

Reviewed changes

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

File Description
internal/metricstest/metricstest.go Adds ExpectedTimerMetric struct and AssertTimerMetrics helper function for validating timer metrics with percentile values
internal/metricstest/metricstest_test.go Adds TestAssertTimerMetrics unit test to verify the new AssertTimerMetrics functionality
examples/hotrod/pkg/tracing/rpcmetrics/observer_test.go Refactors test to use new AssertTimerMetrics API instead of manual metric key construction

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dosubot dosubot bot added the enhancement label Jan 17, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.58%. Comparing base (435a23d) to head (48c6f4f).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7893      +/-   ##
==========================================
+ Coverage   95.56%   95.58%   +0.02%     
==========================================
  Files         316      316              
  Lines       16715    16726      +11     
==========================================
+ Hits        15973    15988      +15     
+ Misses        579      576       -3     
+ Partials      163      162       -1     
Flag Coverage Δ
badger_v1 9.11% <ø> (ø)
badger_v2 1.90% <ø> (ø)
cassandra-4.x-v1-manual 13.41% <ø> (ø)
cassandra-4.x-v2-auto 1.89% <ø> (ø)
cassandra-4.x-v2-manual 1.89% <ø> (ø)
cassandra-5.x-v1-manual 13.41% <ø> (ø)
cassandra-5.x-v2-auto 1.89% <ø> (ø)
cassandra-5.x-v2-manual 1.89% <ø> (ø)
clickhouse 1.98% <ø> (ø)
elasticsearch-6.x-v1 17.27% <ø> (ø)
elasticsearch-7.x-v1 17.30% <ø> (ø)
elasticsearch-8.x-v1 17.45% <ø> (ø)
elasticsearch-8.x-v2 1.90% <ø> (ø)
elasticsearch-9.x-v2 ?
grpc_v1 8.44% <ø> (ø)
grpc_v2 1.90% <ø> (ø)
kafka-3.x-v2 1.90% <ø> (ø)
memory_v2 1.90% <ø> (ø)
opensearch-1.x-v1 17.34% <ø> (ø)
opensearch-2.x-v1 17.34% <ø> (ø)
opensearch-2.x-v2 1.90% <ø> (ø)
opensearch-3.x-v2 1.90% <ø> (ø)
query 1.90% <ø> (ø)
tailsampling-processor 0.54% <ø> (ø)
unittests 94.27% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 17, 2026

Metrics Comparison Summary

Total changes across all snapshots: 0

Detailed changes per snapshot

summary_metrics_snapshot_cassandra

📊 Metrics Diff Summary

Total Changes: 0

  • 🆕 Added: 0 metrics
  • ❌ Removed: 0 metrics
  • 🔄 Modified: 0 metrics
  • 🚫 Excluded: 106 metrics

summary_metrics_snapshot_cassandra

📊 Metrics Diff Summary

Total Changes: 0

  • 🆕 Added: 0 metrics
  • ❌ Removed: 0 metrics
  • 🔄 Modified: 0 metrics
  • 🚫 Excluded: 53 metrics

summary_metrics_snapshot_cassandra

📊 Metrics Diff Summary

Total Changes: 0

  • 🆕 Added: 0 metrics
  • ❌ Removed: 0 metrics
  • 🔄 Modified: 0 metrics
  • 🚫 Excluded: 106 metrics

summary_metrics_snapshot_cassandra

📊 Metrics Diff Summary

Total Changes: 0

  • 🆕 Added: 0 metrics
  • ❌ Removed: 0 metrics
  • 🔄 Modified: 0 metrics
  • 🚫 Excluded: 106 metrics

➡️ View full metrics file

@yurishkuro yurishkuro added the changelog:test Change that's adding missing tests or correcting existing tests label Jan 29, 2026
@yurishkuro yurishkuro merged commit 82694e3 into jaegertracing:main Jan 29, 2026
60 of 61 checks passed
Parship12 pushed a commit to Parship12/jaeger that referenced this pull request Feb 11, 2026
…tracing#7893)

## Which problem is this PR solving?
- Resolves jaegertracing#7891

## Description of the changes
- Add ExpectedTimerMetric struct with Name, Tags, Percentile, and Value
fields
- Add AssertTimerMetrics helper function to metricstest package for
validating timer metrics with percentile values
- Replace hardcoded metric key strings in observer_test.go with the new
AssertTimerMetrics API
- Remove unused assert import from observer_test.go

## How was this change tested?
- Added TestAssertTimerMetrics unit test in metricstest_test.go
- Verified existing tests pass: go test ./internal/metricstest/...
./examples/hotrod/pkg/tracing/rpcmetrics/...

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

Signed-off-by: JaeguKim <rlaworn1993@gmail.com>
SoumyaRaikwar pushed a commit to SoumyaRaikwar/jaeger that referenced this pull request Feb 13, 2026
…tracing#7893)

## Which problem is this PR solving?
- Resolves jaegertracing#7891

## Description of the changes
- Add ExpectedTimerMetric struct with Name, Tags, Percentile, and Value
fields
- Add AssertTimerMetrics helper function to metricstest package for
validating timer metrics with percentile values
- Replace hardcoded metric key strings in observer_test.go with the new
AssertTimerMetrics API
- Remove unused assert import from observer_test.go

## How was this change tested?
- Added TestAssertTimerMetrics unit test in metricstest_test.go
- Verified existing tests pass: go test ./internal/metricstest/...
./examples/hotrod/pkg/tracing/rpcmetrics/...

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

Signed-off-by: JaeguKim <rlaworn1993@gmail.com>
singhvibhanshu pushed a commit to singhvibhanshu/jaeger that referenced this pull request Mar 18, 2026
…tracing#7893)

## Which problem is this PR solving?
- Resolves jaegertracing#7891

## Description of the changes
- Add ExpectedTimerMetric struct with Name, Tags, Percentile, and Value
fields
- Add AssertTimerMetrics helper function to metricstest package for
validating timer metrics with percentile values
- Replace hardcoded metric key strings in observer_test.go with the new
AssertTimerMetrics API
- Remove unused assert import from observer_test.go

## How was this change tested?
- Added TestAssertTimerMetrics unit test in metricstest_test.go
- Verified existing tests pass: go test ./internal/metricstest/...
./examples/hotrod/pkg/tracing/rpcmetrics/...

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

Signed-off-by: JaeguKim <rlaworn1993@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:test Change that's adding missing tests or correcting existing tests enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore]: Add AssertTimerMetrics helper function to metricstest package

3 participants