VictoriaMetrics / victoriametrics-datasource

Grafana datasource for VictoriaMetrics
GNU Affero General Public License v3.0
112 stars 14 forks source link

Why get label names and values from the `/api/v1/series` API, not the `/api/v1/labels` and `/api/v1/label/…/values` API ? #187

Open chenlujjj opened 4 months ago

chenlujjj commented 4 months ago

Hi team, is it better to use the /api/v1/labels and /api/v1/label/…/values APIs instead of /api/v1/series API to fetch label names and values when doing auto-completion in code mode and drop-down list in builder mode, because the latter requests much more data from the database, and sometimes get into timeout or hit maxSeries limit?

Loori-R commented 4 months ago

Hi, @chenlujjj! Yes, using the APIs /api/v1/labels and /api/v1/label/.../values is more optimal. In version v0.8.0, the logic for creating variables was changed to use these APIs. However, in some cases, using /api/v1/series is necessary and cannot be replaced.