Use more informative error msg for timeouts on remote read

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
Jeanette Tan 2025-03-04 00:42:47 +08:00
parent 2ef8706c27
commit 63e66694f0

View file

@ -375,7 +375,8 @@ func (c *Client) Read(ctx context.Context, query *prompb.Query, sortSeries bool)
httpReq.Header.Set("User-Agent", UserAgent)
httpReq.Header.Set("X-Prometheus-Remote-Read-Version", "0.1.0")
ctx, cancel := context.WithTimeout(ctx, c.timeout)
errTimeout := fmt.Errorf("request timed out after %s", c.timeout)
ctx, cancel := context.WithTimeoutCause(ctx, c.timeout, errTimeout)
ctx, span := otel.Tracer("").Start(ctx, "Remote Read", trace.WithSpanKind(trace.SpanKindClient))
defer span.End()