mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Make remote client Store
use passed context (#6673)
* Remote store client's `Store` API currently doesn't use passed context, but instead just constructs a new `context.Background()` Signed-off-by: Anand Singh Kunwar <anandkunwar95@gmail.com>
This commit is contained in:
parent
56ebd5afde
commit
aa61e392b2
|
@ -85,9 +85,8 @@ func (c *Client) Store(ctx context.Context, req []byte) error {
|
|||
httpReq.Header.Set("Content-Type", "application/x-protobuf")
|
||||
httpReq.Header.Set("User-Agent", userAgent)
|
||||
httpReq.Header.Set("X-Prometheus-Remote-Write-Version", "0.1.0")
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
httpResp, err := c.client.Do(httpReq.WithContext(ctx))
|
||||
|
|
Loading…
Reference in a new issue