:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(property-vals): count dropped values by reason in fan-out (#61210)
Andy Zhao1d07c6281b08
diff --git a/rust/property-vals-rs/src/fan_out.rs b/rust/property-vals-rs/src/fan_out.rsindex 6f8d71a5b5b2..8b3c984f6508 100644--- a/rust/property-vals-rs/src/fan_out.rs+++ b/rust/property-vals-rs/src/fan_out.rs@@ -1,6 +1,7 @@use serde_json::Value;use crate::config::ExcludedPropertyKeys;+use crate::metrics_consts::VALUES_DROPPED;use crate::types::{Event, GroupIdentify, PropertyType, PropertyValueMessage, TupleKey};pub const MAX_PROPERTY_KEY_LEN: usize = 400;@@ -70,19 +71,31 @@ fn emit_from_blob(for (key, value) in obj {if value.is_null() {+ metrics::counter!(VALUES_DROPPED, "reason" => "null_value").increment(1);continue;}if excluded.contains(key) {+ metrics::counter!(VALUES_DROPPED, "reason" => "excluded_key").increment(1);continue;}let property_value = coerce_to_string(value);- if key.is_empty() || key.chars().count() > MAX_PROPERTY_KEY_LEN {+ if key.is_empty() {+ metrics::counter!(VALUES_DROPPED, "reason" => "empty_key").increment(1);continue;}- if property_value.is_empty() || property_value.chars().count() > MAX_PROPERTY_VALUE_LEN {+ if key.chars().count() > MAX_PROPERTY_KEY_LEN {+ metrics::counter!(VALUES_DROPPED, "reason" => "key_too_long").increment(1);+ continue;+ }+ if property_value.is_empty() {+ metrics::counter!(VALUES_DROPPED, "reason" => "empty_value").increment(1);+ continue;+ }+ if property_value.chars().count() > MAX_PROPERTY_VALUE_LEN {+ metrics::counter!(VALUES_DROPPED, "reason" => "value_too_long").increment(1);continue;}diff --git a/rust/property-vals-rs/src/metrics_consts.rs b/rust/property-vals-rs/src/metrics_consts.rsindex d6f88a9768ec..70d4a9957543 100644--- a/rust/property-vals-rs/src/metrics_consts.rs+++ b/rust/property-vals-rs/src/metrics_consts.rs@@ -1,5 +1,6 @@pub const EVENTS_RECEIVED: &str = "property_vals_rs_events_received_total";pub const EVENTS_FILTERED: &str = "property_vals_rs_events_filtered_total";+pub const VALUES_DROPPED: &str = "property_vals_rs_values_dropped_total";pub const TUPLES_AGGREGATED: &str = "property_vals_rs_tuples_aggregated_total";pub const FLUSH_TUPLES: &str = "property_vals_rs_flush_tuples";pub const FLUSH_TUPLE_COUNT: &str = "property_vals_rs_flush_tuple_count";