Skip to content

Support Prometheus Metric Metadata API #2974

@wjordan

Description

@wjordan

Is your feature request related to a problem? Please describe.

This feature request is to support the Prometheus Metric Metadata API at /api/v1/metadata in Prometheus v2.15.0+. Similar to #643, but this endpoint returns metadata about scraped metrics without any associated target information.

vmselect currently returns an empty placeholder response for this endpoint (see e6bf88a).

More generally, the request is for VictoriaMetrics to support metric metadata throughout its Prometheus-compatible components. In addition to implementing /api/v1/metadata, metadata would need to be scraped from Prometheus targets and also propagated via Prometheus remote-write, using the metadata field added to the Prometheus remote-write protocol in v2.23.0.

Describe the solution you'd like

A full solution for Prometheus metadata would require updates to a few components:

  • vmselect implements the /api/v1/metadata endpoint with a response containing at least one metadata object per metric name.
  • vmstorage adds support for storing metric metadata.
    • If implementing separate metadata storage is not feasible, a workaround could be to store metadata using a special internal metric name (e.g., _prometheus_metadata) with metadata stored in metric, type, help, unit labels, requiring no change to vmstorage itself.
  • vmagent scrapes metadata from Prometheus targets, and add the metadata field to remote_write requests it sends.
  • Both vmagent and vminsert extract the metadata field from remote_write requests they receive.

Describe alternatives you've considered

Since Victoriametrics currently ignores Prometheus metric metadata, the only alternative would be to proxy this endpoint to another handler which serves metric metadata stored in another system.

Additional context

Since the introduction of the Metric Metadata API, metric metadata has become an increasingly critical part of the Prometheus user experience.

One key use-case related to this feature request is to support Grafana's in-line metrics help text when using VictoriaMetrics as a Prometheus datasource:

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions