Skip to content

proposal: add info-metric label discovery APIs for info() autocomplete - #85

Merged
aknuds1 merged 6 commits into
mainfrom
arve/info-autocomplete
Sep 22, 2026
Merged

aknuds1 merged 6 commits into
mainfrom
arve/info-autocomplete

Conversation

@aknuds1

@aknuds1 aknuds1 commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Editors completing info(<expr>, {…}) need data-label names and values from info metrics scoped to the expression being edited. This proposal adds two dedicated Search API operations:

  • GET|POST /api/v1/search/info_labels searches non-identifying data-label names.
  • GET|POST /api/v1/search/info_label_values searches values for one exact label.

Both endpoints accept repeated full data_match[] matchers, including __name__ matchers selecting info metric families, and an optional instant-vector expr. Expression-derived storage selection follows the lookback, offset, and @ semantics of an instant info() evaluation.

The design builds on PROM-74, reusing the Search API’s storage interfaces, search, ranking, and NDJSON streaming infrastructure. Dedicated routes keep their info-specific scoping and expression-dependent time semantics explicit.

Both require search-api and promql-experimental-functions. A single per-request timeout covers expression evaluation and storage search. Requests containing expr require the same authorization as /api/v1/query.

The proposal defines result limits, expression-derived matcher bounds, fail-closed storage capability checks, and stream completion, warning, and truncation semantics. Suggestions are indexed candidates and do not guarantee a successful runtime join.

Work-in-progress implementation: prometheus/prometheus#17930.

@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch 6 times, most recently from ab1b9ec to 6bf4a84 Compare June 3, 2026 09:13
Comment thread proposals/0085-info-labels-endpoint.md Outdated
Comment thread proposals/0085-info-labels-endpoint.md Outdated
Comment thread proposals/0085-info-labels-endpoint.md Outdated
Comment thread proposals/0085-info-labels-endpoint.md Outdated
Comment thread proposals/0085-info-labels-endpoint.md Outdated
@itsmylife

Copy link
Copy Markdown

I've implemented a PoC in grafana-prometheus-datasource using your PoC in arve/info-autocomplete branch.

From PoC stand point it's working nicely. But we should challenge the return value data type (instead of returning all potential labels/values we might return labels and then values for the selected label. In simple terms I'd like to follow current labels and and label/<label-key>/values style. I think this'll make auto complete easier. It'll also help client to fetch less data.

@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch 2 times, most recently from 1cb8122 to 8a7dc22 Compare July 17, 2026 12:15
@aknuds1 aknuds1 changed the title WIP: proposal: /api/v1/info_labels endpoint for info() autocomplete WIP: proposal: add info-metric label discovery APIs for info() autocomplete Jul 17, 2026
@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch from 8a7dc22 to ebb9e87 Compare July 17, 2026 13:54
@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch 2 times, most recently from 37ac590 to ab6ea6e Compare August 29, 2026 11:07
@aknuds1 aknuds1 changed the title WIP: proposal: add info-metric label discovery APIs for info() autocomplete proposal: add info-metric label discovery APIs for info() autocomplete Aug 29, 2026
@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch from ab6ea6e to 11a8be7 Compare August 29, 2026 12:24
@aknuds1
aknuds1 marked this pull request as ready for review August 29, 2026 12:50
@aknuds1

aknuds1 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

But we should challenge the return value data type (instead of returning all potential labels/values we might return labels and then values for the selected label.

@itsmylife This dual-endpoint scheme has been implemented. Thanks for the feedback!

@aknuds1
aknuds1 requested review from colega, roidelapluie and tcp13equals2 and removed request for colega and tcp13equals2 August 29, 2026 13:27
Comment thread proposals/0085-info-labels-endpoint.md Outdated
@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch from 477232b to 84ad643 Compare September 14, 2026 17:04
@roidelapluie

Copy link
Copy Markdown
Member

I would keep the endpoint behind /search. /search was meant partly for autocomplete, so it would be a fit. Also we could reuse some of the code and ensure some consistency between the endpoints.

I have no strong opinion about reusing endpoints with scope=info vs new endpoints. New enpoints might be easier to document and to use.

Note that we have also defined semantics that might be useful here, such as include_medatata.

@aknuds1

aknuds1 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

I would keep the endpoint behind /search. /search was meant partly for autocomplete, so it would be a fit.

Thanks @roidelapluie - done!

Note that we have also defined semantics that might be useful here, such as include_medatata.

Included a note on this.

@roidelapluie

Copy link
Copy Markdown
Member

Approved. I’d like it to remain experimental until we have a clearer picture of performance under realistic autocomplete usage. I suggest reusing the search-api toggle, with two separate entries in /api/v1/features for general search and info-label search, so clients can distinguish support for each.

@aknuds1

aknuds1 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @roidelapluie!

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Document the request profiles and client requirements learned from the Grafana info() autocomplete proof of concept. Clarify expression interpolation, response bounds, and terminal NDJSON handling.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1
aknuds1 force-pushed the arve/info-autocomplete branch from 9c63b1e to 3f6b1a6 Compare September 22, 2026 06:08
@aknuds1
aknuds1 merged commit c0f4c9c into main Sep 22, 2026
2 checks passed
@aknuds1
aknuds1 deleted the arve/info-autocomplete branch September 22, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants