api: renames method for consistency
This commit is contained in:
parent
8cb7769e36
commit
123637b5ca
|
@ -283,7 +283,7 @@ type QueryAPI interface {
|
||||||
// QueryRange performs a query for the given range.
|
// QueryRange performs a query for the given range.
|
||||||
QueryRange(ctx context.Context, query string, r Range) (model.Value, error)
|
QueryRange(ctx context.Context, query string, r Range) (model.Value, error)
|
||||||
// QueryLabelValues performs a query for the values of the given label.
|
// 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.
|
// 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
|
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})
|
u := h.client.url(epLabelValues, map[string]string{"name": label})
|
||||||
req, err := http.NewRequest(http.MethodGet, u.String(), nil)
|
req, err := http.NewRequest(http.MethodGet, u.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -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 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"},
|
inRes: []string{"val1", "val2"},
|
||||||
reqMethod: "GET",
|
reqMethod: "GET",
|
||||||
reqPath: "/api/v1/label/mylabel/values",
|
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"),
|
inErr: fmt.Errorf("some error"),
|
||||||
reqMethod: "GET",
|
reqMethod: "GET",
|
||||||
reqPath: "/api/v1/label/mylabel/values",
|
reqPath: "/api/v1/label/mylabel/values",
|
||||||
|
|
Loading…
Reference in New Issue