-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
More granular query performance metrics for Thanos store #4895
Comments
I think it would be nicer if you would propose a PR with proposal to Thanos as flow https://thanos.io/tip/contributing/proposal-process.md/. This will allow us to start discussion on each separate part of the proposal. Otherwise, I like it. I wonder only:
I don't see any issues if we keep permutation of 6 and maybe make it optional (: |
cc @GiedriusS @yeya24 @wiardvanrij, our SLO expert @metalmatze, @kakkoyun @brancz for more opinions (: |
Honestly, your questions are deeper than I'm working with our stack. So I haven't formed an entire opinion on it, other than that I pretty much agree with everything you said. As for the solution. I remembered a potential new feature that might resolve your implementation problem? https://youtu.be/F72Tk8iaWeA Sparse histograms. |
Yes. I'm contemplating what this configuration would look like. Perhaps passing in arrays for each of the 'histogram partitions' (i.e. the labels we attach to observations that categorise number of series and number of samples)
Yeah agreed. If these are going to be configurable, it's probably useful to encode the literal number instead of t-shirt sizes to avoid confusion. I guess using labels instead of numbers helps when aggregating across bucket changes when the labels may change if they are reconfigured. |
@moadz you were talking about the extent of our ability to know tenant usage of querier which got me thinking - it could be really nice to extend these query path timing metrics to include tenant (or some configurable label) as an extra dimension. This would increase the cardinality significantly, but I can imagine it being very useful. |
@ianbillett that would be very useful, but I wonder if it would encourage improper usage of this metric.
|
You make some good points there @moadz - I think the richer query logger is what I was picturing in mind :) |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Is your proposal related to a problem?
This is a follow-up to the discussion by @ianbillett #4674 about measuring query performance in Thanos.
tl;dr: We would like to measure query path latency in a reliable and consistent way to supplement our read path SLIs.
Currently in Red Hat's internal observability service, we're using Avalanche in conjunction with the
http_request_duration_seconds
on thequery_range
andquery
handlers.This gives us some idea of overall latency for each query request we process, but does not allow us to investigate the impact of 'query shape' and data distribution across our store targets.
Describe the solution you'd like
There's a few reason why measuring the latency on the
query
andquery_range
endpoints is a poor indicator of how much 'work' Thanos is doing. Thanos will fanout the 'select' phase of the query to each of its store targets (other stores, sidecars etc.) , streaming the series from each target over the network, before executing the query on the resulting stream. This means that we actually touch far more series over the network than is returned in the final query response. An ideal metric for query performance must include the total number of samples and series retrieved remotely before the query is executed.Ideally this metric will include:
Mercifully, we already capture these stats in tracing spans from the query path. Unfortunately, traces are sampled and are difficult to query reliably for SLI's. My suggestion is that we add a new histogram,
thanos_store_query_duration_seconds
that persists the total elapsed time for the query, with labels forseries_processed
andsamples_processed
attached to each observation to allow for querying for a particular dimension (e.g.thanos_query_duration_seconds
for the0.99
request duration quantile with> 1,000,000 samples
returned). Ideally we would represent this with an N-dimensional histogram, but this is not possible with prometheus.Given most queries will have highly variable samples/series returned for each query, how do we manage cardinality?
Yes, in fact if we used the unique samples/series I suspect this metric would be totally useless. Instead we should define a set of 5-10 distinct 't-shirt size' buckets for the samples/series dimensions.
e.g. Exponential Scale
So if a query returns
50,000 samples
spanning10 series
in32s
it would be an observation of32s
with the labelssample-size=l, series-size=s
.This would allow us to define query SLI's with respect to a specific number of series/samples and mean response time
e.g. 90% of queries for up to 1,000,000 samples and up to 10 series complete in less than 2s.
How will we determine appropriate buckets for our additional dimensions?
This is my primary concern. Given the countless permutations of node size, data distribution and thanos topologies that might influence the query sizes and response times, it is unlikely any set thresholds will be appropriate for all deployments of Thanos. As a result, the 't-shirt sizes' will have to be configurable (possibly via runtime args) with some sensible defaults to allow users to tweak them. The obvious caveat being that if this metric is recorded, any changes to the bucketing would render previous data corrupted/incomprehensible. I would like guidance here if possible.
Describe alternatives you've considered
I'm keen to understand how others have measured query performance (systematically) in the context of Thanos/Prometheus, or the potential issues with introducing a metric of this type.
The text was updated successfully, but these errors were encountered: