mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-05 17:27:51 +00:00
Extract timeout from context in Prom client
For vector and range queries, the Prometheus HTTP API takes a timeout parameter. Previously, we ignored this parameter. Now, we check to see if the context passed to the query contains a deadline, and if so, compare that to the current time to calculate an appropriate timeout for query evaulation.
This commit is contained in:
parent
d1d60f7f5e
commit
01755d5acb
2 changed files with 20 additions and 5 deletions
|
|
@ -40,7 +40,9 @@ type Range struct {
|
|||
Step time.Duration
|
||||
}
|
||||
|
||||
// TODO: support timeout in the client?
|
||||
// Client is a Prometheus client for the Prometheus HTTP API.
|
||||
// The "timeout" parameter for the HTTP API is set based on the context's deadline,
|
||||
// when present and applicable.
|
||||
type Client interface {
|
||||
// Series lists the time series matching the given series selectors
|
||||
Series(ctx context.Context, interval model.Interval, selectors ...Selector) ([]Series, error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue