From 123637b5cabaf9ec32397d742d84ca34a4c17eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carvalho?= Date: Fri, 31 Mar 2017 21:07:16 -0300 Subject: [PATCH] api: renames method for consistency --- api/prometheus/api.go | 4 ++-- api/prometheus/api_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/prometheus/api.go b/api/prometheus/api.go index 29eed5d..9a5cc88 100644 --- a/api/prometheus/api.go +++ b/api/prometheus/api.go @@ -283,7 +283,7 @@ type QueryAPI interface { // QueryRange performs a query for the given range. QueryRange(ctx context.Context, query string, r Range) (model.Value, error) // QueryLabelValues performs a query for the values of the given label. - QueryLabelValues(ctx context.Context, label string) ([]string, error) + LabelValues(ctx context.Context, label string) ([]string, error) } // NewQueryAPI returns a new QueryAPI for the client. @@ -355,7 +355,7 @@ func (h *httpQueryAPI) QueryRange(ctx context.Context, query string, r Range) (m return model.Value(qres.v), err } -func (h *httpQueryAPI) QueryLabelValues(ctx context.Context, label string) ([]string, error) { +func (h *httpQueryAPI) LabelValues(ctx context.Context, label string) ([]string, error) { u := h.client.url(epLabelValues, map[string]string{"name": label}) req, err := http.NewRequest(http.MethodGet, u.String(), nil) if err != nil { diff --git a/api/prometheus/api_test.go b/api/prometheus/api_test.go index 4a38572..2d6c40b 100644 --- a/api/prometheus/api_test.go +++ b/api/prometheus/api_test.go @@ -373,9 +373,9 @@ func TestAPIs(t *testing.T) { } } - doQueryLabelValues := func(label string) func() (interface{}, error) { + doLabelValues := func(label string) func() (interface{}, error) { return func() (interface{}, error) { - return queryAPI.QueryLabelValues(context.Background(), label) + return queryAPI.LabelValues(context.Background(), label) } } @@ -434,7 +434,7 @@ func TestAPIs(t *testing.T) { }, { - do: doQueryLabelValues("mylabel"), + do: doLabelValues("mylabel"), inRes: []string{"val1", "val2"}, reqMethod: "GET", reqPath: "/api/v1/label/mylabel/values", @@ -442,7 +442,7 @@ func TestAPIs(t *testing.T) { }, { - do: doQueryLabelValues("mylabel"), + do: doLabelValues("mylabel"), inErr: fmt.Errorf("some error"), reqMethod: "GET", reqPath: "/api/v1/label/mylabel/values",