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 27, 2020
1 parent 7810669 commit 6c9cb08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions api/prometheus/v1/api.go
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,7 +812,7 @@ 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) {
func (h *httpAPI) Metadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error) {
u := h.client.URL(epMetricsMetadata, nil)
q := u.Query()

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 6c9cb08

Please sign in to comment.