Skip to content

feature: Add exemplar without observation/incrementing? #868

Open
@LouisStAmour

Description

@LouisStAmour

The use case I have in mind is for trace-derived metrics in something like an Otel Collector, where you want to output near real-time metrics but you want to add traces as exemplars (such as what Grafana supports) but you can't do both: sometimes you'll want to mark an interesting trace as an exemplar but you only know it's interesting because a later-processed inner span had an exception event and your exemplar would thus have an "exception" label on it to highlight it in red, possibly.

A similar idea I have is to automatically pick some exemplars based on what buckets they go into when observing for a histogram. This would I suppose be a new API call to observeWithExemplarCandidate say, that would take the same exemplar data but based on the histogram bucketing it could be picked as an exemplar or not and would return whether picked as an exemplar or not (maybe?)

The alternative to such a sampling API would be to allow observations to histograms like normal where the choice of observing with exemplar could be compared against the current value of the histogram, such as to know whether the value is an outlier or not. The difficulty here is that you might not have many requests and you might want to sample one request per bucket. At that point, you again need to keep your bucket data for up to a minute, then decide on which exemplars to add up to a minute after you've first observed them. That's again something that requires separating backdated exemplars from real-time observations, thus proving the need for this API call.

I'm new to the Prometheus client library community, so please let me know if this idea has merit. I'm thinking of suggesting the same in the Otel Collector community as I'm having a hard time adopting trace-derived metrics for Grafana's new support of exemplars without being able to separate real-time metrics from past-observed exemplar values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions