diff --git a/src/query/api/v1/handler/prom/common.go b/src/query/api/v1/handler/prom/common.go index 6fe71d50c4..cfabf76290 100644 --- a/src/query/api/v1/handler/prom/common.go +++ b/src/query/api/v1/handler/prom/common.go @@ -36,14 +36,6 @@ import ( // formats with prometheus. // https://github.com/prometheus/prometheus/blob/43acd0e2e93f9f70c49b2267efa0124f1e759e86/web/api/v1/api.go#L1097 -const ( - queryParam = "query" - startParam = "start" - endParam = "end" - stepParam = "step" - timeoutParam = "timeout" -) - var ( minTime = time.Unix(math.MinInt64/1000+62135596801, 0).UTC() maxTime = time.Unix(math.MaxInt64/1000-62135596801, 999999999).UTC() @@ -61,17 +53,6 @@ const ( type errorType string -const ( - errorNone errorType = "" - errorTimeout errorType = "timeout" - errorCanceled errorType = "canceled" - errorExec errorType = "execution" - errorBadData errorType = "bad_data" - errorInternal errorType = "internal" - errorUnavailable errorType = "unavailable" - errorNotFound errorType = "not_found" -) - type queryData struct { ResultType promql.ValueType `json:"resultType"` Result promql.Value `json:"result"` diff --git a/src/query/api/v1/handler/prom/read.go b/src/query/api/v1/handler/prom/read.go index 24f69c2986..5ba2112dfa 100644 --- a/src/query/api/v1/handler/prom/read.go +++ b/src/query/api/v1/handler/prom/read.go @@ -26,7 +26,6 @@ import ( "context" "errors" "net/http" - "time" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/native" @@ -48,12 +47,6 @@ type readHandler struct { logger *zap.Logger } -type readRequest struct { - query string - start, end time.Time - step, timeout time.Duration -} - func newReadHandler( opts Options, hOpts options.HandlerOptions, diff --git a/src/query/api/v1/handler/prom/read_test.go b/src/query/api/v1/handler/prom/read_test.go index 0d9b521aae..bdda76aa2f 100644 --- a/src/query/api/v1/handler/prom/read_test.go +++ b/src/query/api/v1/handler/prom/read_test.go @@ -43,6 +43,12 @@ import ( const promQuery = `http_requests_total{job="prometheus",group="canary"}` +const ( + queryParam = "query" + startParam = "start" + endParam = "end" +) + var testPromQLEngine = newMockPromQLEngine() type testHandlers struct { @@ -85,7 +91,7 @@ func defaultParams() url.Values { now := time.Now() vals.Add(queryParam, promQuery) vals.Add(startParam, now.Format(time.RFC3339)) - vals.Add(endParam, string(now.Add(time.Hour).Format(time.RFC3339))) + vals.Add(endParam, now.Add(time.Hour).Format(time.RFC3339)) vals.Add(handleroptions.StepParam, (time.Duration(10) * time.Second).String()) return vals } @@ -94,7 +100,7 @@ func defaultParamsWithoutQuery() url.Values { vals := url.Values{} now := time.Now() vals.Add(startParam, now.Format(time.RFC3339)) - vals.Add(endParam, string(now.Add(time.Hour).Format(time.RFC3339))) + vals.Add(endParam, now.Add(time.Hour).Format(time.RFC3339)) vals.Add(handleroptions.StepParam, (time.Duration(10) * time.Second).String()) return vals }