Skip to content
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

[query] Remove dead code in prom package #2871

Merged
merged 3 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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