Skip to content

Commit d789447

Browse files
authored
metric(consumer): Add a metric to track the size of individual spans (#6300)
We only have this metric for generic metrics but it would be useful to have for spans to potentially help understand memory profiles of the spans consumer.
1 parent b43bf24 commit d789447

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rust_snuba/src/processors/spans.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::str::FromStr;
33

44
use anyhow::Context;
55
use chrono::DateTime;
6+
use rust_arroyo::timer;
67
use schemars::JsonSchema;
78
use serde::{Deserialize, Serialize};
89
use uuid::Uuid;
@@ -22,6 +23,8 @@ pub fn process_message(
2223
let payload_bytes = payload.payload().context("Expected payload")?;
2324
let msg: FromSpanMessage = serde_json::from_slice(payload_bytes)?;
2425

26+
timer!("spans.messages.size", payload_bytes.len() as f64);
27+
2528
let origin_timestamp = DateTime::from_timestamp(msg.received as i64, 0);
2629
let mut span: Span = msg.try_into()?;
2730

0 commit comments

Comments
 (0)