Skip to content

Commit 7d7ea65

Browse files
authored
Receive: Ensure forward/replication metrics are incremented in err cases (#8212)
* Ensure forward/replication metrics are incremented in err cases This commit ensures forward and replication metrics are incremented with err labels. This seemed to be missing, came across this whilst working on a dashboard. Signed-off-by: Saswata Mukherjee <[email protected]> * Add changelog Signed-off-by: Saswata Mukherjee <[email protected]> --------- Signed-off-by: Saswata Mukherjee <[email protected]>
1 parent 92db7aa commit 7d7ea65

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
2424

2525
- [#8211](https://github.com/thanos-io/thanos/pull/8211) Query: fix panic on nested partial response in distributed instant query
2626
- [#8216](https://github.com/thanos-io/thanos/pull/8216) Query/Receive: fix iter race between `next()` and `stop()` introduced in https://github.com/thanos-io/thanos/pull/7821.
27+
- [#8212](https://github.com/thanos-io/thanos/pull/8212) Receive: Ensure forward/replication metrics are incremented in err cases
2728

2829
## [v0.38.0](https://github.com/thanos-io/thanos/tree/release-0.38) - 03.04.2025
2930

docs/components/receive.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Please see the metric `thanos_receive_forward_delay_seconds` to see if you need
331331

332332
The following formula is used for calculating quorum:
333333

334-
```go mdox-exec="sed -n '1029,1039p' pkg/receive/handler.go"
334+
```go mdox-exec="sed -n '1034,1044p' pkg/receive/handler.go"
335335
// writeQuorum returns minimum number of replicas that has to confirm write success before claiming replication success.
336336
func (h *Handler) writeQuorum() int {
337337
// NOTE(GiedriusS): this is here because otherwise RF=2 doesn't make sense as all writes

pkg/receive/handler.go

+5
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,11 @@ func (h *Handler) sendRemoteWrite(
10151015
}
10161016
h.peers.markPeerAvailable(endpoint)
10171017
} else {
1018+
h.forwardRequests.WithLabelValues(labelError).Inc()
1019+
if !alreadyReplicated {
1020+
h.replications.WithLabelValues(labelError).Inc()
1021+
}
1022+
10181023
// Check if peer connection is unavailable, update the peer state to avoid spamming that peer.
10191024
if st, ok := status.FromError(err); ok {
10201025
if st.Code() == codes.Unavailable {

0 commit comments

Comments
 (0)