Skip to content

Commit

Permalink
[query] Remove dead code in prom package (#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpranckaitis authored Nov 12, 2020
1 parent 96a5efb commit 78db238
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
19 changes: 0 additions & 19 deletions src/query/api/v1/handler/prom/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"`
Expand Down
7 changes: 0 additions & 7 deletions src/query/api/v1/handler/prom/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down
10 changes: 8 additions & 2 deletions src/query/api/v1/handler/prom/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 78db238

Please sign in to comment.