Repository navigation
Conversation
| Namespace: "prometheus", | ||
| Subsystem: "api", | ||
| Help: "How long was the wait at the gate before the query execution", | ||
| Buckets: prometheus.ExponentialBuckets(0.1, 2, 10), |
There was a problem hiding this comment.
Just a question from the sidelines: this adds 13 new time series (10 buckets + Inf bucket + sum + count series). That's not terrible, but I wonder if what you want to get out of the metric could be achieved even simpler? For example, this is how the Linux kernel measures CPU/memory/... resource pressure: https://facebookmicrosites.github.io/psi/docs/overview
Or maybe in this case it could also just be the cumulative number of seconds spent in the queue, without a full distribution? Then if you divide that (rate-ed) by the number of queries, you get the average wait time, which also gives you a good idea of whether you're hitting any limits at all.
There was a problem hiding this comment.
@juliusv thanks for the review and sorry for the delay. Your suggestion makes sense. I have updated my code.
juliusv
left a comment
There was a problem hiding this comment.
Great, yeah that's better! Now the one thing I'm still thinking about: the Gate is implemented as a general utility, but it's currently only used in one place (the remote read handler). Currently the metric help text suggests that it's used to gate some queries, but isn't clear about the type of queries it gates. If it's only ever meant to be used by remote read queries, then it should probably say that, or if it's meant to be a general gate however, it might even be incorrect to mention queries at all (if it's ever used by something else). I think the cleanest way to resolve that would be one of these alternatives:
- A: Just move the gate functionality out of
utilto the single usage site and make the metric name even more remote-read specific. - B: Keep it in
utilbut allow passing in the metric (instead of a registerer) so that the specific caller can name and describe the metric appropriately. - C: Keep it in
utilbut allow passing in the name of the thing being gated, which could then be put into a label (would have to think about the proper label name for that).
Honestly A or B are probably most reasonable IMO.
Add a metric that shows how long we need to wait before a request in the remote read handler gets executed. It is useful to have it to understand whether the concurrency limit needs to be lifted or not. Signed-off-by: Giedrius Statkevičius <[email protected]>
|
Very valid points! I have done B as it permits code reuse in projects and has maximum flexibility. |
|
@juliusv kind ping 🤗 |
| Namespace: "prometheus", | ||
| Subsystem: "api", | ||
| Help: "Total sum of how long was the wait at the gate before query execution", | ||
| Name: "gate_total_wait_duration_seconds", |
There was a problem hiding this comment.
The structure of the code looks good now, but given that we are passing the metric into the gate, we can now also change the metric name and its description to be more specific to how the gate's usage. We have some precedent at
prometheus/storage/remote/read_handler.go
Lines 56 to 61 in f55ab22
prometheus_api_remote_read_wait_duration_seconds_total (for the fully expanded metric name), with a description of Total number of seconds spent waiting at the query gate before remote read query execution?
|
cc @GiedriusS Can you please address Julius' comment and rebase this pull request please? Thanks! |
|
Looking at this during the bug scrub again. We'll close this for now as there was no follow-up, but we would love to see @GiedriusS (or anyone else) to pick up the work. |
Add a metric that shows how long we need to wait before a request in the remote read handler gets executed. It is useful to have it to understand whether the concurrency limit needs to be lifted or not.
Closes #11365.
Signed-off-by: Giedrius Statkevičius [email protected]