Skip to content

remote write: fix sent_batch_duration_seconds measuring before the request is sent#18214

Merged
cstyan merged 2 commits intoprometheus:mainfrom
kgeckhart:kgeckhart/fix-sent-batch-duration
Mar 3, 2026
Merged

remote write: fix sent_batch_duration_seconds measuring before the request is sent#18214
cstyan merged 2 commits intoprometheus:mainfrom
kgeckhart:kgeckhart/fix-sent-batch-duration

Conversation

@kgeckhart
Copy link
Contributor

The refactor in #17441 moved the latency metric to measure before the request was sent causing it to be an inaccurate measurement.

Which issue(s) does the PR fix:

N/A

Does this PR introduce a user-facing change?

[BUGFIX] Remote write: fix `prometheus_remote_storage_sent_batch_duration_seconds` measuring before the request was sent.

…quest was sent

Signed-off-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
kgeckhart added a commit to grafana/alloy that referenced this pull request Mar 2, 2026
…ng before the request was sent (#5697)

`prometheus_remote_storage_sent_batch_duration_seconds` was measuring
before the HTTP request was sent rather than after, causing the metric
to reflect encoding/serialization time rather than the actual send
duration.

Applies the fix from prometheus/prometheus#18214
via a fork replace directive pointing to
https://github.com/grafana/prometheus/tree/fix-sent-batch-duration-v0.309.1.

Remove the replace directive when upstream PR #18214 is merged and
Prometheus is upgraded.
grafana-alloybot bot pushed a commit to grafana/alloy that referenced this pull request Mar 2, 2026
…ng before the request was sent (#5697)

`prometheus_remote_storage_sent_batch_duration_seconds` was measuring
before the HTTP request was sent rather than after, causing the metric
to reflect encoding/serialization time rather than the actual send
duration.

Applies the fix from prometheus/prometheus#18214
via a fork replace directive pointing to
https://github.com/grafana/prometheus/tree/fix-sent-batch-duration-v0.309.1.

Remove the replace directive when upstream PR #18214 is merged and
Prometheus is upgraded.

(cherry picked from commit 10cfb6c)
kgeckhart added a commit to grafana/alloy that referenced this pull request Mar 2, 2026
…ng before the request was sent [backport] (#5698)

## Backport of #5697

This PR backports #5697 to release/v1.14.

### Original PR Author
@kgeckhart

### Description
`prometheus_remote_storage_sent_batch_duration_seconds` was measuring
before the HTTP request was sent rather than after, causing the metric
to reflect encoding/serialization time rather than the actual send
duration.

Applies the fix from prometheus/prometheus#18214
via a fork replace directive pointing to
https://github.com/grafana/prometheus/tree/fix-sent-batch-duration-v0.309.1.

Remove the replace directive when upstream PR #18214 is merged and
Prometheus is upgraded.

---
*This backport was created automatically.*

Co-authored-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
Signed-off-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
@cstyan
Copy link
Member

cstyan commented Mar 3, 2026

rerunning the failed windows tests, failures don't look related to your changes

Copy link
Member

@cstyan cstyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @kgeckhart

@cstyan cstyan merged commit 897ba10 into prometheus:main Mar 3, 2026
55 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants