Skip to content

api: provide metadata for a specified metric#6442

Merged
beorn7 merged 2 commits intoprometheus:masterfrom
gotjosh:single-metric-api
Dec 11, 2019
Merged

api: provide metadata for a specified metric#6442
beorn7 merged 2 commits intoprometheus:masterfrom
gotjosh:single-metric-api

Conversation

@gotjosh
Copy link
Member

@gotjosh gotjosh commented Dec 10, 2019

This adds support for a new query param on the new api/v1/metadata endpoint that provides metadata for a specified metric via the V1 API. Similarly to the api/v1/target/metadata the metadata is only available for the lifecycle of the attached target.

An example of a payload looks like:

curl -G http://localhost:9090/api/v1/metadata?metric=http_requests_total | jq

{
  "status": "success",
  "data": {
    "http_requests_total": [
      {
        "type": "counter",
        "help": "Number of HTTP requests",
        "unit": ""
      },
      {
        "type": "counter",
        "help": "Amount of HTTP requests",
        "unit": ""
      }
    ]
  }
}

Follow up from #6420
Closes #6395

Signed-off-by: gotjosh <josue@grafana.com>
@gotjosh gotjosh changed the title api: Single metric api api: provide metadata for a specified metric Dec 10, 2019
Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be part of the existing api.

@gotjosh
Copy link
Member Author

gotjosh commented Dec 10, 2019

This should probably be part of the existing api.

Do you prefer the same handler to be reused even if it's a separate endpoint or do you want to include the functionality in the same endpoint but via a query param?

I'm not sure about the latter as the proposal described a separate endpoint unless we all agree to deviate from that.

@brian-brazil
Copy link
Contributor

It's basically the same code currently, so I'd have it all in one endpoint. It's also what we do elsewhere, we don't want to end up with an endpoint per possible parameter combination.

This adds support for a new query param on the new `api/v1/metadata`
endpoint that provides metadata for a specified metric via the V1 API.

It collapses metadata that is equal across all targets, and aggregates
under the same metric name the ones that differ.

Signed-off-by: gotjosh <josue@grafana.com>
@brian-brazil
Copy link
Contributor

👍

@beorn7 I believe that comment is what you wanted.

Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Add API endpoint to retrieve metadata by metric name

3 participants