Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show function hints when selecting a native histogram #86388

Closed
bohandley opened this issue Apr 16, 2024 · 1 comment · Fixed by #87017
Closed

Show function hints when selecting a native histogram #86388

bohandley opened this issue Apr 16, 2024 · 1 comment · Fixed by #87017

Comments

@bohandley
Copy link
Contributor

bohandley commented Apr 16, 2024

The query editor will provide hints for classic histogram metrics by showing the function histogram_quantile. But, when a user selects a native histogram, none of the native histogram functions are shown as hints.

Classic histogram

Image

Native histogram

Image

Native histogram function hints should include
histogram_avg no documentation link yet, just merged: prometheus/prometheus#13467
histogram_count
histogram_sum
histogram_fraction
histogram_stddev
histogram_stdvar

How to differentiate classic and native?

If we know a metric is of a certain type, we can show a hint.

Currently there is no metadata available for native histograms so we have little to differentiate them from classic. (See grafana/alloy#547).

We know classic histograms always end in _bucket, _sum, or _count like
cortex_request_duration_seconds_bucket

And a native histogram metric would have everything but the suffix.
cortex_request_duration_seconds

One suggestion is that if we know there is a classic histogram available, we can identify it, remove the suffix and create a collection of native histogram metric names. We could then compare any selected metric to that collection to identify it as a native histogram. This is not as nice as simply checking the metadata for the type, but it is one idea.

*update: The above idea will not work because classic histograms will be removed and there will be nothing to compare native histograms to.

What we are left with is a metric name with no clear frontend way to identify it's type. Another solution is to create a resource-like call that queries a chosen metric and parses the response to identify the metric as a native histogram, then return this information to the frontend to provide the hint. This would not be scalable to apply to all metrics but it could provide us the hint.

**Additional update: use metadata and test with vanilla Prometheus see slack for more context https://raintank-corp.slack.com/archives/C02UC0KCSF4/p1713424061722829?thread_ts=1708519355.394509&cid=C02UC0KCSF4

We discussed this with Beorn yesterday and the best information and API currently is the metadata endpoint. If it has the type==histogram and the series doesn't end in _bucket, _count or _sum, you can be reasonably sure that it is a native histogram.

@bohandley
Copy link
Contributor Author

PR enables these hints

Image

Image

@bohandley bohandley self-assigned this Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant