Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: gotjosh <josue@grafana.com>
  • Loading branch information
gotjosh committed Feb 28, 2020
1 parent 7810669 commit 2463b8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions api/prometheus/v1/api.go
Expand Up @@ -130,7 +130,7 @@ const (
epSeries = apiPrefix + "/series"
epTargets = apiPrefix + "/targets"
epTargetsMetadata = apiPrefix + "/targets/metadata"
epMetricsMetadata = apiPrefix + "/metadata"
epMetadata = apiPrefix + "/metadata"
epRules = apiPrefix + "/rules"
epSnapshot = apiPrefix + "/admin/tsdb/snapshot"
epDeleteSeries = apiPrefix + "/admin/tsdb/delete_series"
Expand Down Expand Up @@ -249,8 +249,8 @@ type API interface {
Targets(ctx context.Context) (TargetsResult, error)
// TargetsMetadata returns metadata about metrics currently scraped by the target.
TargetsMetadata(ctx context.Context, matchTarget string, metric string, limit string) ([]MetricMetadata, error)
// MetricMetadata returns metadata about metrics currently scraped by the metric name.
MetricsMetadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error)
// Metadata returns metadata about metrics currently scraped by the metric name.
Metadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error)
}

// AlertsResult contains the result from querying the alerts endpoint.
Expand Down Expand Up @@ -812,8 +812,8 @@ func (h *httpAPI) TargetsMetadata(ctx context.Context, matchTarget string, metri
return res, json.Unmarshal(body, &res)
}

func (h *httpAPI) MetricsMetadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error) {
u := h.client.URL(epMetricsMetadata, nil)
func (h *httpAPI) Metadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error) {
u := h.client.URL(epMetadata, nil)
q := u.Query()

q.Set("metric", metric)
Expand Down
8 changes: 4 additions & 4 deletions api/prometheus/v1/api_test.go
Expand Up @@ -202,9 +202,9 @@ func TestAPIs(t *testing.T) {
}
}

doMetricsMetadata := func(metric string, limit string) func() (interface{}, Warnings, error) {
doMetadata := func(metric string, limit string) func() (interface{}, Warnings, error) {
return func() (interface{}, Warnings, error) {
v, err := promAPI.MetricsMetadata(context.Background(), metric, limit)
v, err := promAPI.Metadata(context.Background(), metric, limit)
return v, nil, err
}
}
Expand Down Expand Up @@ -866,7 +866,7 @@ func TestAPIs(t *testing.T) {
},

{
do: doMetricsMetadata("go_goroutines", "1"),
do: doMetadata("go_goroutines", "1"),
inRes: map[string]interface{}{
"go_goroutines": []map[string]interface{}{
{
Expand Down Expand Up @@ -894,7 +894,7 @@ func TestAPIs(t *testing.T) {
},

{
do: doMetricsMetadata("", "1"),
do: doMetadata("", "1"),
inErr: fmt.Errorf("some error"),
reqMethod: "GET",
reqPath: "/api/v1/metadata",
Expand Down

0 comments on commit 2463b8e

Please sign in to comment.