Add a metric for tracking max_samples_per_send (#8102)

Currently there is no way of tracking the value of the
`max_samples_per_send` configuration option, which is commonly tweaked
when integrating with a remote write backend.

Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com>
This commit is contained in:
Jorge Luis Betancourt 2020-10-28 12:39:36 +01:00 committed by GitHub
parent 3245b3267b
commit 4dc755cd27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,6 +64,7 @@ type queueManagerMetrics struct {
minNumShards prometheus.Gauge
desiredNumShards prometheus.Gauge
bytesSent prometheus.Counter
maxSamplesPerSend prometheus.Gauge
}
func newQueueManagerMetrics(r prometheus.Registerer, rn, e string) *queueManagerMetrics {
@ -176,6 +177,13 @@ func newQueueManagerMetrics(r prometheus.Registerer, rn, e string) *queueManager
Help: "The total number of bytes sent by the queue.",
ConstLabels: constLabels,
})
m.maxSamplesPerSend = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "max_samples_per_send",
Help: "The maximum number of samples to be sent, in a single request, to the remote storage.",
ConstLabels: constLabels,
})
return m
}
@ -197,6 +205,7 @@ func (m *queueManagerMetrics) register() {
m.minNumShards,
m.desiredNumShards,
m.bytesSent,
m.maxSamplesPerSend,
)
}
}
@ -217,6 +226,7 @@ func (m *queueManagerMetrics) unregister() {
m.reg.Unregister(m.minNumShards)
m.reg.Unregister(m.desiredNumShards)
m.reg.Unregister(m.bytesSent)
m.reg.Unregister(m.maxSamplesPerSend)
}
}
@ -372,6 +382,7 @@ func (t *QueueManager) Start() {
t.metrics.maxNumShards.Set(float64(t.cfg.MaxShards))
t.metrics.minNumShards.Set(float64(t.cfg.MinShards))
t.metrics.desiredNumShards.Set(float64(t.cfg.MinShards))
t.metrics.maxSamplesPerSend.Set(float64(t.cfg.MaxSamplesPerSend))
t.shards.start(t.numShards)
t.watcher.Start()