[metricstore] Remove min step API from metricstore#8425
Conversation
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
There was a problem hiding this comment.
Pull request overview
Removes the GetMinStepDuration metricstore API surface and its backend implementations, since it’s no longer used by the UI.
Changes:
- Dropped
GetMinStepDurationfrommetricstore.Readerand removedMinStepDurationQueryParameters. - Removed
GetMinStepDurationimplementations/tests from ClickHouse v2, Prometheus, Elasticsearch, and disabled metricstores. - Removed metrics instrumentation and related mocks for
GetMinStepDuration.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/storage/v1/api/metricstore/interface.go | Removes GetMinStepDuration from the Reader interface and deletes its query params type. |
| internal/storage/v1/api/metricstore/mocks/mocks.go | Updates generated mocks to match the new Reader interface (drops min-step method). |
| internal/storage/v1/api/metricstore/metricstoremetrics/decorator.go | Removes decorator instrumentation for the min-step operation. |
| internal/storage/v1/api/metricstore/metricstoremetrics/decorator_test.go | Adjusts tests for decorator behavior (but still needs updates to expected counters). |
| internal/storage/v2/clickhouse/metricstore/reader.go | Removes ClickHouse v2 stub implementation for GetMinStepDuration. |
| internal/storage/v2/clickhouse/metricstore/reader_test.go | Removes ClickHouse v2 tests for GetMinStepDuration. |
| internal/storage/metricstore/prometheus/metricstore/reader.go | Removes Prometheus min-step constant and method implementation. |
| internal/storage/metricstore/prometheus/metricstore/reader_test.go | Removes Prometheus GetMinStepDuration test. |
| internal/storage/metricstore/elasticsearch/reader.go | Removes Elasticsearch min-step constant and method implementation. |
| internal/storage/metricstore/elasticsearch/reader_test.go | Removes Elasticsearch GetMinStepDuration test. |
| internal/storage/metricstore/disabled/reader.go | Removes disabled-reader GetMinStepDuration implementation. |
| internal/storage/metricstore/disabled/reader_test.go | Removes disabled-reader GetMinStepDuration test. |
| cmd/jaeger/internal/extension/jaegerquery/internal/http_handler.go | Removes the min-step handler implementation (but route registration still references it). |
| cmd/jaeger/internal/extension/jaegerquery/internal/http_handler_test.go | Removes min-step endpoint test (but another test still calls /api/metrics/minstep). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func (aH *APIHandler) metrics(w http.ResponseWriter, r *http.Request, getMetrics func(context.Context, metricstore.BaseQueryParameters) (*metrics.MetricFamily, error)) { | ||
| requestParams, err := aH.queryParser.parseMetricsQueryParams(r) | ||
| if aH.handleError(w, err, http.StatusBadRequest) { |
There was a problem hiding this comment.
minStep handler was removed, but RegisterRoutes still registers /metrics/minstep via aH.minStep, which will not compile. Remove the route registration (and any related endpoint expectations) to fully drop the API, or reintroduce the handler if the endpoint should remain supported.
| // getJSON fetches a JSON document from a server via HTTP GET | ||
| func getJSON(url string, out any) error { | ||
| return getJSONCustomHeaders(url, make(map[string]string), out) |
There was a problem hiding this comment.
TestMetricsQueryDisabled still calls /api/metrics/minstep and expects the "metrics querying is currently disabled" error. Since the minstep endpoint is being removed, this test case should be deleted or updated to assert the new expected behavior (e.g., 404 / route not found) after the route is removed.
| counters, gauges := mf.Snapshot() | ||
| wantCounts := map[string]int64{ | ||
| "requests|operation=get_latencies|result=ok": 1, |
There was a problem hiding this comment.
The expected counters in wantCounts still include operation=get_min_step_duration, but GetMinStepDuration instrumentation was removed from the decorator. Update the expected counter maps in this test (and the failing-calls variant below) to remove get_min_step_duration entries.
| counters, gauges := mf.Snapshot() | ||
| wantCounts := map[string]int64{ | ||
| "requests|operation=get_latencies|result=ok": 0, |
There was a problem hiding this comment.
This test’s wantCounts map still expects operation=get_min_step_duration counters, but the decorator no longer emits them after removing GetMinStepDuration. Remove those expected entries so the assertions reflect the updated decorator.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8425 +/- ##
==========================================
- Coverage 96.10% 96.09% -0.01%
==========================================
Files 323 323
Lines 20643 20619 -24
==========================================
- Hits 19838 19814 -24
Misses 649 649
Partials 156 156
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:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -41,11 +40,10 @@ func (q *queryMetrics) emit(err error, latency time.Duration) { | |||
| // NewReadMetricsDecorator returns a new ReadMetricsDecorator. | |||
There was a problem hiding this comment.
The doc comment says NewReadMetricsDecorator but the function is named NewReaderDecorator. Please update the comment to match the actual function name (or rename the function) so GoDoc and search results are accurate.
| // NewReadMetricsDecorator returns a new ReadMetricsDecorator. | |
| // NewReaderDecorator returns a new ReadMetricsDecorator. |
| aH.handleFunc(router, aH.latencies, http.MethodGet, "/metrics/latencies") | ||
| aH.handleFunc(router, aH.calls, http.MethodGet, "/metrics/calls") | ||
| aH.handleFunc(router, aH.errors, http.MethodGet, "/metrics/errors") | ||
| aH.handleFunc(router, aH.minStep, http.MethodGet, "/metrics/minstep") | ||
| aH.handleFunc(router, aH.getQualityMetrics, http.MethodGet, "/quality-metrics") |
There was a problem hiding this comment.
This PR removes the /api/metrics/minstep endpoint, but docker-compose/monitor/README.md still documents and demonstrates it. Please update/remove that documentation (or add a note about removal) to avoid broken examples for users.
yurishkuro
left a comment
There was a problem hiding this comment.
we also need to remove it from IDL
Which problem is this PR solving?
GetMinStepDurationfor ClickHouse Storage #8421 (comment)Description of the changes
GetMinStepDurationfunction and all its implementations as it is not used by the UI today.How was this change tested?
Checklist
make lint testAI Usage in this PR (choose one)
See AI Usage Policy.