Skip to content

Codemirror - TS Prometheus Client: performance improvement when getting label name and values#17194

Merged
Nexucis merged 4 commits intomainfrom
nexucis/change-usage-lookback
Nov 4, 2025
Merged

Codemirror - TS Prometheus Client: performance improvement when getting label name and values#17194
Nexucis merged 4 commits intomainfrom
nexucis/change-usage-lookback

Conversation

@Nexucis
Copy link
Member

@Nexucis Nexucis commented Sep 15, 2025

This PR is changing the way the Typescript Prometheus client is working.

This client is used afterward in the PromQL autocompletion.

Before, when getting the label names and values, we were setting a time interval to 12 hours. In a big Prometheus or in huge Thanos cluster, this query can be costly and most of the time not necessary for the autocompletion, specially when calling the endpoint /api/v1/series

Also the code that autocomplete label values or labels names when associated to a metric name is calling the endpoint /api/v1/series causing OOMKilled when big Prometheus or Thanos cluster are involved.

For example, autocomplete a label values associated to a metric name is currently crashing Thanos querier in Amadeus (and they are running with 60 GB of memory)

With this PR, if the interval is not explicitly defined, then the autocompletion will get the label values and label names without setting a time interval, relying on the default server configuration instead.

It will also always call the endpoint api/v1/labels or /api/v1/label/<label_name> with the parameter matcher to get the label names and values associated to a metric.

This change should improve the performance of the autocompletion.

For the context, this provides a way to tackle this issue: thanos-io/thanos#4685

[ENHANCEMENT] UI: Performance improvement when getting label name and values in promql editor.

… set

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis requested a review from juliusv as a code owner September 15, 2025 14:47
@Nexucis
Copy link
Member Author

Nexucis commented Sep 15, 2025

if possible, it would be great to include this PR in the current release so we can provide this change in Thanos.

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis changed the title Codemirror - TS Prometheus Client: don't use lookback interval if not set Codemirror - TS Prometheus Client: performance improvement when getting label name and values Sep 15, 2025
@Nexucis Nexucis marked this pull request as draft September 15, 2025 16:46
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis marked this pull request as ready for review September 15, 2025 17:48
@Nexucis
Copy link
Member Author

Nexucis commented Oct 2, 2025

ping @juliusv in case it went out of your radar :)

Let me know if you need further explanation !

Copy link
Member

@juliusv juliusv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, never got to this PR, sorry! Sounds good though 😊👍

Seems like the release notes CI check needs to be fixed?

@Nexucis Nexucis merged commit 03d0c18 into main Nov 4, 2025
46 of 47 checks passed
@Nexucis Nexucis deleted the nexucis/change-usage-lookback branch November 4, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants