Skip to content

Commit b9547d8

Browse files
vpranckaitisrobskillington
authored andcommitted
[query] Remove dead code in prom package (#2871)
1 parent 57a17cf commit b9547d8

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

src/query/api/v1/handler/prom/common.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ import (
3636
// formats with prometheus.
3737
// https://github.com/prometheus/prometheus/blob/43acd0e2e93f9f70c49b2267efa0124f1e759e86/web/api/v1/api.go#L1097
3838

39-
const (
40-
queryParam = "query"
41-
startParam = "start"
42-
endParam = "end"
43-
stepParam = "step"
44-
timeoutParam = "timeout"
45-
)
46-
4739
var (
4840
minTime = time.Unix(math.MinInt64/1000+62135596801, 0).UTC()
4941
maxTime = time.Unix(math.MaxInt64/1000-62135596801, 999999999).UTC()
@@ -61,17 +53,6 @@ const (
6153

6254
type errorType string
6355

64-
const (
65-
errorNone errorType = ""
66-
errorTimeout errorType = "timeout"
67-
errorCanceled errorType = "canceled"
68-
errorExec errorType = "execution"
69-
errorBadData errorType = "bad_data"
70-
errorInternal errorType = "internal"
71-
errorUnavailable errorType = "unavailable"
72-
errorNotFound errorType = "not_found"
73-
)
74-
7556
type queryData struct {
7657
ResultType promql.ValueType `json:"resultType"`
7758
Result promql.Value `json:"result"`

src/query/api/v1/handler/prom/read.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"context"
2727
"errors"
2828
"net/http"
29-
"time"
3029

3130
"github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions"
3231
"github.com/m3db/m3/src/query/api/v1/handler/prometheus/native"
@@ -48,12 +47,6 @@ type readHandler struct {
4847
logger *zap.Logger
4948
}
5049

51-
type readRequest struct {
52-
query string
53-
start, end time.Time
54-
step, timeout time.Duration
55-
}
56-
5750
func newReadHandler(
5851
opts Options,
5952
hOpts options.HandlerOptions,

src/query/api/v1/handler/prom/read_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ import (
4343

4444
const promQuery = `http_requests_total{job="prometheus",group="canary"}`
4545

46+
const (
47+
queryParam = "query"
48+
startParam = "start"
49+
endParam = "end"
50+
)
51+
4652
var testPromQLEngine = newMockPromQLEngine()
4753

4854
type testHandlers struct {
@@ -85,7 +91,7 @@ func defaultParams() url.Values {
8591
now := time.Now()
8692
vals.Add(queryParam, promQuery)
8793
vals.Add(startParam, now.Format(time.RFC3339))
88-
vals.Add(endParam, string(now.Add(time.Hour).Format(time.RFC3339)))
94+
vals.Add(endParam, now.Add(time.Hour).Format(time.RFC3339))
8995
vals.Add(handleroptions.StepParam, (time.Duration(10) * time.Second).String())
9096
return vals
9197
}
@@ -94,7 +100,7 @@ func defaultParamsWithoutQuery() url.Values {
94100
vals := url.Values{}
95101
now := time.Now()
96102
vals.Add(startParam, now.Format(time.RFC3339))
97-
vals.Add(endParam, string(now.Add(time.Hour).Format(time.RFC3339)))
103+
vals.Add(endParam, now.Add(time.Hour).Format(time.RFC3339))
98104
vals.Add(handleroptions.StepParam, (time.Duration(10) * time.Second).String())
99105
return vals
100106
}

0 commit comments

Comments
 (0)