Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit ed427d5

Browse files
Fix: 0 samples/sec in throughput by logging metric metadata throughput.
Signed-off-by: Harkishen-Singh <[email protected]> This commit fixes `0 samples/sec` logging in throughput. The reason behind this behaviour was metric-metadata not being printed, rather it was just updating the `metrics-max-ts-send`, which was causing the log. The `metrics-max-ts-send` was updated even when we were writing metadata. This commit also updates the logging of throughput, by making samples, spans and metric-metadata log in the same line, than the earlier separate lines. This allows better utilization of log lines.
1 parent 584c4a1 commit ed427d5

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ We use the following categories for changes:
1818
reader and writer [#1020].
1919
- Run timescaledb-tune with the promscale profile [#1615]
2020
- Propagate the context from received HTTP read requests downstream to database
21-
requests [#1205].
21+
requests [#1205]
22+
23+
### Changed
24+
- Log throughput in the same line for samples, spans and metric metadata [#1643]
2225

2326
### Fixed
2427
- Fix broken cache eviction in clockcache [#1603]

pkg/util/throughput/throughput.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package throughput
66

77
import (
8+
"fmt"
89
"sync"
910
"sync/atomic"
1011
"time"
@@ -70,16 +71,24 @@ func (tc *throughputCalc) run() {
7071
continue
7172
}
7273

73-
if samplesRate+metadataRate != 0 {
74-
// Metric data ingested.
74+
throughput := []interface{}{"msg", "ingestor throughput"}
75+
if samplesRate != 0 {
7576
maxSentTs := timestamp.Time(atomic.LoadInt64(&tc.metricsMaxSentTs))
76-
log.Info("msg", "ingestor throughput", "samples/sec", int(samplesRate), "metrics-max-sent-ts", maxSentTs)
77+
throughput = append(throughput, []interface{}{"samples/sec", fmt.Sprint(int(samplesRate)), "metrics-max-sent-ts", maxSentTs.String()}...)
7778
}
7879

7980
if spansRate != 0 {
80-
// Spans ingested.
8181
spansLastWriteOn := timestamp.Time(atomic.LoadInt64(&tc.spansLastWriteOn))
82-
log.Info("msg", "ingestor throughput", "spans/sec", int(spansRate), "spans-last-write-on", spansLastWriteOn)
82+
throughput = append(throughput, []interface{}{"spans/sec", fmt.Sprint(int(spansRate)), "spans-last-write-on", spansLastWriteOn.String()}...)
83+
}
84+
85+
if metadataRate != 0 {
86+
throughput = append(throughput, []interface{}{"metric-metadata/sec", fmt.Sprint(metadataRate)}...)
87+
}
88+
89+
if len(throughput) > 2 {
90+
// Log only if we had any activity.
91+
log.Info(throughput...)
8392
}
8493
}
8594
}

0 commit comments

Comments
 (0)