Skip to content

Commit 058140d

Browse files
authored
Add metric to track added latency to write requests (#5781)
1 parent dcbd3bd commit 058140d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* [ENHANCEMENT] Unsafe search hints for frontend performance tests [#5723](https://github.com/grafana/tempo/pull/5723) (@ruslan-mikhailov)
1414
* [ENHANCEMENT] Add new livestore alert to the tempo-mixin [#5752](https://github.com/grafana/tempo/pull/5752) (@javiermolinar)
1515
* [ENHANCEMENT] Improve shutdown time in the first 30 seconds [#5725](https://github.com/grafana/tempo/pull/5725) (@ldufr)
16+
* [ENHANCEMENT] Add metric for tracking added latency to write requests [#](https://github.com/grafana/tempo/pull/) (@mapno)
1617
* [BUGFIX] Fix compactor to properly consider SSE-KMS information during metadata copy [#5774](https://github.com/grafana/tempo/pull/5774) (@steffsas)
1718
* [BUGFIX] Correctly track and reject too large traces in live stores. [#5757](https://github.com/grafana/tempo/pull/5757) (@joe-elliott)
1819
* [BUGFIX] Fix issues related to integer dedicated columns in vParquet5-preview2 [#5716](https://github.com/grafana/tempo/pull/5716) (@stoewer)

modules/distributor/artificial_delay.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@ package distributor
33
import (
44
"math/rand"
55
"time"
6+
7+
"github.com/prometheus/client_golang/prometheus"
8+
"github.com/prometheus/client_golang/prometheus/promauto"
69
)
710

11+
var metricAddedLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
12+
Namespace: "tempo",
13+
Subsystem: "distributor",
14+
Name: "added_latency_seconds",
15+
NativeHistogramBucketFactor: 1.1,
16+
NativeHistogramMaxBucketNumber: 100,
17+
NativeHistogramMinResetDuration: time.Hour,
18+
}, []string{"tenant"})
19+
820
func (d *Distributor) padWithArtificialDelay(reqStart time.Time, userID string) {
921
artificialDelay := d.cfg.ArtificialDelay
1022
if artificialDelayOverride, ok := d.overrides.IngestionArtificialDelay(userID); ok {
@@ -19,6 +31,7 @@ func (d *Distributor) padWithArtificialDelay(reqStart time.Time, userID string)
1931
// If the request took longer than the target delay, we don't delay at all as sleep will return immediately for a negative value
2032
reqDuration := d.now().Sub(reqStart)
2133
delay := artificialDelay - reqDuration
34+
metricAddedLatency.WithLabelValues(userID).Observe(delay.Seconds())
2235
d.sleep(durationWithJitter(delay, 0.10))
2336
}
2437

0 commit comments

Comments
 (0)