: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
fix(propdefs): rename two metrics that describe the wrong thing (#79319)
Eli Reisman7eff8618afc7
diff --git a/rust/property-defs-rs/src/lib.rs b/rust/property-defs-rs/src/lib.rsindex eaac0d903261..1ed7dec61dff 100644--- a/rust/property-defs-rs/src/lib.rs+++ b/rust/property-defs-rs/src/lib.rs@@ -5,10 +5,10 @@ use batch_ingestion::process_batch;use common_kafka::kafka_consumer::{RecvErr, SingleTopicConsumer};use config::Config;use metrics_consts::{- BATCH_ACQUIRE_TIME, CACHE_CONSUMED, CACHE_LEN, COMPACTED_UPDATES, DUPLICATES_IN_BATCH,- EMPTY_EVENTS, EVENTS_RECEIVED, EVENT_PARSE_ERROR, FORCED_SMALL_BATCH, RECV_DEQUEUED,- SKIPPED_DUE_TO_TEAM_FILTER, UPDATES_FILTERED_BY_CACHE, UPDATES_PER_EVENT, UPDATES_SEEN,- UPDATE_PRODUCER_OFFSET, WORKER_BLOCKED,+ BATCH_ACQUIRE_TIME, CACHE_FILL_RATIO, CACHE_LEN, COMPACTED_UPDATES, DUPLICATES_IN_BATCH,+ EMPTY_EVENTS, EVENTS_RECEIVED, EVENT_PARSE_ERROR, FORCED_SMALL_BATCH, OFFSET_STORE_FAILURES,+ RECV_DEQUEUED, SKIPPED_DUE_TO_TEAM_FILTER, UPDATES_FILTERED_BY_CACHE, UPDATES_PER_EVENT,+ UPDATES_SEEN, WORKER_BLOCKED,};use types::{Event, Update};@@ -118,7 +118,7 @@ pub async fn update_consumer_loop(];for (cap, label, len) in per_cache {let cap_f = cap as f64;- metrics::gauge!(CACHE_CONSUMED, &[("cache", label)]).set(if cap_f > 0.0 {+ metrics::gauge!(CACHE_FILL_RATIO, &[("cache", label)]).set(if cap_f > 0.0 {len as f64 / cap_f} else {0.0@@ -199,7 +199,7 @@ pub async fn update_producer_loop(match offset.store() {Ok(_) => (),Err(e) => {- metrics::counter!(UPDATE_PRODUCER_OFFSET, &[("op", "store_fail")]).increment(1);+ metrics::counter!(OFFSET_STORE_FAILURES).increment(1);// TODO: consumer json_recv() should expose the source partition ID tooerror!("update_producer_loop: failed to store offset {curr_offset}, got: {e}");}diff --git a/rust/property-defs-rs/src/metrics_consts.rs b/rust/property-defs-rs/src/metrics_consts.rsindex 4a668012887d..2469d5860003 100644--- a/rust/property-defs-rs/src/metrics_consts.rs+++ b/rust/property-defs-rs/src/metrics_consts.rs@@ -8,13 +8,26 @@ pub const UPDATES_FILTERED_BY_CACHE: &str = "prop_defs_filtered_by_cache";pub const EMPTY_EVENTS: &str = "prop_defs_empty_events";pub const EVENT_PARSE_ERROR: &str = "prop_defs_event_parse_error";pub const BATCH_ACQUIRE_TIME: &str = "prop_defs_batch_acquire_time_ms";-pub const CACHE_CONSUMED: &str = "prop_defs_cache_space";+// Fraction of a subcache's capacity currently occupied, 0.0 to 1.0. Not an absolute size:+// CACHE_LEN carries that, and a threshold written against this one has to be a fraction.+pub const CACHE_FILL_RATIO: &str = "prop_defs_cache_fill_ratio";pub const CACHE_LEN: &str = "prop_defs_cache_len";pub const CACHE_HITS: &str = "prop_defs_cache_hits";pub const CACHE_MISSES: &str = "prop_defs_cache_misses";pub const CACHE_EVICTIONS: &str = "prop_defs_cache_evictions";pub const UPDATES_CACHE: &str = "prop_defs_updates_cache";-pub const UPDATE_PRODUCER_OFFSET: &str = "prop_defs_update_producer_offset";+// Kafka offset stores that failed. The producer loop continues past a failure, so a later+// successful store on the same partition supersedes it and nothing is redelivered. Redelivery+// only follows a failure that a rebalance or restart interrupts before the next store lands.+pub const OFFSET_STORE_FAILURES: &str = "prop_defs_offset_store_failures";++// Outcomes of group-type resolution, labeled `action`:+// hit local cache had the index+// miss local cache did not, and personhog resolved it (a cache miss, not a failure)+// negative_hit a recent unresolvable lookup is still within its TTL, so we skipped personhog+// fail personhog returned no mapping, and the definition is dropped+// A hit rate must divide by the sum of all four. Dividing by hit + miss alone silently drops+// both of the outcomes where a definition does not get written.pub const GROUP_TYPE_CACHE: &str = "prop_defs_group_type_cache";pub const RECV_DEQUEUED: &str = "prop_defs_recv_dequeued";pub const COMPACTED_UPDATES: &str = "prop_defs_compaction_dropped_updates";