8000 Feature Request: Support Label-Based Filtering for `/api/v1/metadata` Endpoint · Issue #16802 · prometheus/prometheus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Feature Request: Support Label-Based Filtering for /api/v1/metadata Endpoint #16802
Open
@mutefiRe

Description

@mutefiRe

Proposal

In multi-tenant Prometheus setups (e.g with https://github.com/prometheus-community/prom-label-proxy) - particularly in IoT or edge environments - exposing the /api/v1/metadata endpoint can pose a security concern. Currently, the endpoint only supports filtering by metric names, as noted in the official documentation:

https://prometheus.io/docs/prometheus/latest/querying/api/#querying-metric-metadata

This means the endpoint returns metadata for all metrics known to Prometheus, regardless of origin. In environments where tenants share a Prometheus instance or where metrics are federated from multiple sources, this can unintentionally leak metric names and metadata across tenant boundaries.

Why this matters

In a multi-tenant environment, restricting API access to tenant-specific data is essential. Unlike endpoints such as /api/v1/query or /api/v1/series, the /api/v1/metadata endpoint cannot currently be scoped using label matchers, which makes it incompatible with secure tenancy enforcement mechanisms that rely on label-based access control.

Workarounds considered

A possible workaround involves:

  1. Fetching relevant metric names using /api/v1/series with appropriate label matchers.
  2. Filtering the full /api/v1/metadata 5419 response proxy-side/client-side.

However, this approach is inefficient and brittle, particularly at scale.

Proposed enhancement

Introduce support for label-based filtering to the /api/v1/metadata endpoint, similar to other query endpoints. For example:

GET /api/v1/metadata?match[]={tenant="foo"}

This would allow more secure and scoped access to metric metadata, making a step towards multi-tenancy enablement.

Thanks for considering this enhancement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0