Skip to content

Commit

Permalink
metric(consumer): Add a metric to track the size of individual spans (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ayirr7 authored Sep 13, 2024
1 parent b43bf24 commit d789447
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rust_snuba/src/processors/spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::str::FromStr;

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

timer!("spans.messages.size", payload_bytes.len() as f64);

let origin_timestamp = DateTime::from_timestamp(msg.received as i64, 0);
let mut span: Span = msg.try_into()?;

Expand Down

0 comments on commit d789447

Please sign in to comment.