-
Notifications
You must be signed in to change notification settings - Fork 3k
[metricstore] Remove min step API from metricstore #8425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,7 +119,6 @@ func (aH *APIHandler) RegisterRoutes(router *http.ServeMux) { | |
| 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") | ||
| } | ||
|
|
||
|
|
@@ -379,18 +378,6 @@ func (aH *APIHandler) errors(w http.ResponseWriter, r *http.Request) { | |
| }) | ||
| } | ||
|
|
||
| func (aH *APIHandler) minStep(w http.ResponseWriter, r *http.Request) { | ||
| minStep, err := aH.metricsQueryService.GetMinStepDuration(r.Context(), &metricstore.MinStepDurationQueryParameters{}) | ||
| if aH.handleError(w, err, http.StatusInternalServerError) { | ||
| return | ||
| } | ||
|
|
||
| structuredRes := structuredResponse{ | ||
| Data: minStep.Milliseconds(), | ||
| } | ||
| aH.writeJSON(w, r, &structuredRes) | ||
| } | ||
|
|
||
| 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) { | ||
|
Comment on lines
381
to
383
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -974,13 +974,6 @@ func TestMetricsReaderError(t *testing.T) { | |
| mockedResponse: nil, | ||
| wantErrorMessage: "error fetching call rates", | ||
| }, | ||
| { | ||
| urlPath: "/api/metrics/minstep", | ||
| mockedQueryMethod: "GetMinStepDuration", | ||
| mockedQueryMethodParamType: "*metricstore.MinStepDurationQueryParameters", | ||
| mockedResponse: time.Duration(0), | ||
| wantErrorMessage: "error fetching min step duration", | ||
| }, | ||
| } { | ||
| t.Run(tc.wantErrorMessage, func(t *testing.T) { | ||
| // Prepare | ||
|
|
@@ -1017,11 +1010,6 @@ func TestMetricsQueryDisabled(t *testing.T) { | |
| urlPath: "/api/metrics/latencies?service=emailservice&quantile=0.95", | ||
| wantErrorMessage: "metrics querying is currently disabled", | ||
| }, | ||
| { | ||
| name: "metrics query disabled error returned when fetching min step duration", | ||
| urlPath: "/api/metrics/minstep", | ||
| wantErrorMessage: "metrics querying is currently disabled", | ||
| }, | ||
| } { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| // Test | ||
|
|
@@ -1034,26 +1022,6 @@ func TestMetricsQueryDisabled(t *testing.T) { | |
| } | ||
| } | ||
|
|
||
| func TestGetMinStep(t *testing.T) { | ||
| metricsReader := &metricsmocks.Reader{} | ||
| ts := initializeTestServer(t, HandlerOptions.MetricsQueryService(metricsReader)) | ||
| defer ts.server.Close() | ||
| // Prepare | ||
| metricsReader.On( | ||
| "GetMinStepDuration", | ||
| mock.Anything, | ||
| mock.AnythingOfType("*metricstore.MinStepDurationQueryParameters"), | ||
| ).Return(5*time.Millisecond, nil).Once() | ||
|
|
||
| // Test | ||
| var response structuredResponse | ||
| err := getJSON(ts.server.URL+"/api/metrics/minstep", &response) | ||
|
|
||
| // Verify | ||
| require.NoError(t, err) | ||
| assert.InDelta(t, float64(5), response.Data, 0.01) | ||
| } | ||
|
|
||
| // 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) | ||
|
Comment on lines
1025
to
1027
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,11 +14,10 @@ import ( | |||||
|
|
||||||
| // ReadMetricsDecorator wraps a metricstore.Reader and collects metrics around each read operation. | ||||||
| type ReadMetricsDecorator struct { | ||||||
| reader metricstore.Reader | ||||||
| getLatenciesMetrics *queryMetrics | ||||||
| getCallRatesMetrics *queryMetrics | ||||||
| getErrorRatesMetrics *queryMetrics | ||||||
| getMinStepDurationMetrics *queryMetrics | ||||||
| reader metricstore.Reader | ||||||
| getLatenciesMetrics *queryMetrics | ||||||
| getCallRatesMetrics *queryMetrics | ||||||
| getErrorRatesMetrics *queryMetrics | ||||||
| } | ||||||
|
|
||||||
| type queryMetrics struct { | ||||||
|
|
@@ -41,11 +40,10 @@ func (q *queryMetrics) emit(err error, latency time.Duration) { | |||||
| // NewReadMetricsDecorator returns a new ReadMetricsDecorator. | ||||||
|
||||||
| // NewReadMetricsDecorator returns a new ReadMetricsDecorator. | |
| // NewReaderDecorator returns a new ReadMetricsDecorator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR removes the
/api/metrics/minstependpoint, butdocker-compose/monitor/README.mdstill documents and demonstrates it. Please update/remove that documentation (or add a note about removal) to avoid broken examples for users.