|
| 1 | +diff --git a/modules/ingester/flush.go b/modules/ingester/flush.go |
| 2 | +index 6db7fc8fc..8315332d4 100644 |
| 3 | +--- a/modules/ingester/flush.go |
| 4 | ++++ b/modules/ingester/flush.go |
| 5 | +@@ -178,6 +178,12 @@ func (i *Ingester) cutAllInstancesToWal() { |
| 6 | + } |
| 7 | + |
| 8 | + func (i *Ingester) cutOneInstanceToWal(instance *instance, immediate bool) { |
| 9 | ++ startTime := time.Now() |
| 10 | ++ defer func() { |
| 11 | ++ duration := time.Since(startTime).Seconds() |
| 12 | ++ instance.cutToWalDuration.WithLabelValues(strconv.FormatBool(immediate)).Observe(duration) |
| 13 | ++ }() |
| 14 | ++ |
| 15 | + // cut traces internally |
| 16 | + err := instance.CutCompleteTraces(i.cfg.MaxTraceIdle, i.cfg.MaxTraceLive, immediate) |
| 17 | + if err != nil { |
| 18 | +diff --git a/modules/ingester/instance.go b/modules/ingester/instance.go |
| 19 | +index c324b88e6..a9478be29 100644 |
| 20 | +--- a/modules/ingester/instance.go |
| 21 | ++++ b/modules/ingester/instance.go |
| 22 | +@@ -74,6 +74,19 @@ var ( |
| 23 | + Name: "ingester_replay_errors_total", |
| 24 | + Help: "The total number of replay errors received per tenant.", |
| 25 | + }, []string{"tenant"}) |
| 26 | ++ metricCutToWalDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ |
| 27 | ++ Namespace: "tempo", |
| 28 | ++ Name: "ingester_cut_traces_to_wal_duration_seconds", |
| 29 | ++ Help: "Time spent cutting traces to wal", |
| 30 | ++ // These buckets are configured to keep the duration shorter than 30s (flush_check_period). |
| 31 | ++ Buckets: []float64{ |
| 32 | ++ 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, |
| 33 | ++ 5.0, 6.0, 7.0, 8.0, 9.0, |
| 34 | ++ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, |
| 35 | ++ 16.0, 18.0, 20.0, 22.0, 24.0, 26.0, 28.0, |
| 36 | ++ 30.0, 35.0, 40.0, 45.0, 50.0, 55.0, 60.0, |
| 37 | ++ }, |
| 38 | ++ }, []string{"tenant", "immediate"}) |
| 39 | + ) |
| 40 | + |
| 41 | + type instance struct { |
| 42 | +@@ -94,6 +107,7 @@ type instance struct { |
| 43 | + instanceID string |
| 44 | + tracesCreatedTotal prometheus.Counter |
| 45 | + bytesReceivedTotal *prometheus.CounterVec |
| 46 | ++ cutToWalDuration prometheus.ObserverVec |
| 47 | + limiter Limiter |
| 48 | + writer tempodb.Writer |
| 49 | + |
| 50 | +@@ -117,6 +131,7 @@ func newInstance(instanceID string, limiter Limiter, overrides ingesterOverrides |
| 51 | + instanceID: instanceID, |
| 52 | + tracesCreatedTotal: metricTracesCreatedTotal.WithLabelValues(instanceID), |
| 53 | + bytesReceivedTotal: metricBytesReceivedTotal, |
| 54 | ++ cutToWalDuration: metricCutToWalDuration.MustCurryWith(prometheus.Labels{"tenant": instanceID}), |
| 55 | + limiter: limiter, |
| 56 | + writer: writer, |
| 57 | + |
0 commit comments