VictoriaMetrics / grafana-datasource

Grafana Plugin for VictoriaMetrics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `limit` param for metrics discovery

hagen1778 opened this issue · comments

Grafana's Prometheus datasource could return too many series on /api/v1/series or /api/v1/labels API and crash user's browser.
VictoriaMetrics supports limit param for these APIs - see https://docs.victoriametrics.com/#prometheus-querying-api-enhancements

VictoriaMetrics accepts limit query arg for /api/v1/labels and /api/v1/label//values handlers for limiting the number of returned entries. For example, the query to /api/v1/labels?limit=5 returns a sample of up to 5 unique labels, while ignoring the rest of labels. If the provided limit value exceeds the corresponding -search.maxTagKeys / -search.maxTagValues command-line flag values, then limits specified in the command-line flags are used.

By default, VictoriaMetrics returns time series for the last day starting at 00:00 UTC from /api/v1/series, /api/v1/labels and /api/v1/label//values, while the Prometheus API defaults to all time. Explicitly set start and end to select the desired time range. VictoriaMetrics rounds the specified start..end time range to day granularity because of performance optimization concerns. If you need the exact set of label names and label values on the given time range, then send queries to /api/v1/query or to /api/v1/query_range.

VictoriaMetrics accepts limit query arg at /api/v1/series for limiting the number of returned entries. For example, the query to /api/v1/series?limit=5 returns a sample of up to 5 series, while ignoring the rest of series. If the provided limit value exceeds the corresponding -search.maxSeries command-line flag values, then limits specified in the command-line flags are used.

Would be nice if we had these limits configurable and preset in the datasource.

The issue was added in 3d45f97 and will be included to the next release