Add AssertTimerMetrics helper function to metricstest package#7893
Add AssertTimerMetrics helper function to metricstest package#7893yurishkuro merged 2 commits intojaegertracing:mainfrom
Conversation
Signed-off-by: JaeguKim <rlaworn1993@gmail.com>
There was a problem hiding this comment.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Metrics Comparison SummaryTotal changes across all snapshots: 0 Detailed changes per snapshotsummary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
summary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
summary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
summary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 0
|
…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>
…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>
…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>
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger:make lint testjaeger-ui:npm run lintandnpm run test