Skip to content

Commit 593648f

Browse files
committed
remote write: add request size histogram
Signed-off-by: Matt Klein <[email protected]>
1 parent 0554aaf commit 593648f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pulse-metrics/src/pipeline/outflow/http/remote_write.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use http::HeaderMap;
3030
use prometheus::{Histogram, IntCounter, IntGauge};
3131
use protobuf::MessageField;
3232
use protobuf::well_known_types::duration::Duration;
33+
use pulse_common::LossyIntToFloat;
3334
use pulse_common::proto::ProtoDurationToStdDuration;
3435
use pulse_protobuf::protos::pulse::config::common::v1::retry::RetryPolicy;
3536
use pulse_protobuf::protos::pulse::config::outflow::v1::outflow_common::{
@@ -56,6 +57,7 @@ struct HttpRemoteWriteOutflowStats {
5657
requests_retry: IntCounter,
5758
requests_total: IntCounter,
5859
requests_time: Histogram,
60+
requests_size: Histogram,
5961
offload_queue_tx: IntCounter,
6062
offload_queue_rx: IntCounter,
6163
tx_bytes: IntCounter,
@@ -71,6 +73,20 @@ impl HttpRemoteWriteOutflowStats {
7173
requests_retry: stats.counter("requests_retry"),
7274
requests_total: stats.counter("requests_total"),
7375
requests_time: stats.histogram("requests_time"),
76+
requests_size: stats.histogram_with_buckets(
77+
"requests_size",
78+
&[
79+
65536.0, // 64 KiB
80+
131_072.0, // 128 KiB
81+
262_144.0, // 256 KiB
82+
393_216.0, // 384 KiB
83+
524_288.0, // 512 KiB
84+
786_432.0, // 768 KiB
85+
1_048_576.0, // 1 MiB
86+
1_310_720.0, // 1.25 MiB
87+
1_572_864.0, // 1.5 MiB
88+
],
89+
),
7490
offload_queue_tx: stats.counter("offload_queue_tx"),
7591
offload_queue_rx: stats.counter("offload_queue_rx"),
7692
tx_bytes: stats.counter("tx_bytes"),
@@ -239,6 +255,10 @@ impl HttpRemoteWriteOutflow {
239255
};
240256

241257
log::debug!("sending batch of {num_metrics} metric(s)");
258+
self
259+
.stats
260+
.requests_size
261+
.observe(compressed_write_request.len().lossy_to_f64());
242262
let time = self.stats.requests_time.start_timer();
243263
let res = self
244264
.retry

0 commit comments

Comments
 (0)