diff --git a/rust_snuba/src/processors/generic_metrics.rs b/rust_snuba/src/processors/generic_metrics.rs index f7fa30b9cb..010e731ef5 100644 --- a/rust_snuba/src/processors/generic_metrics.rs +++ b/rust_snuba/src/processors/generic_metrics.rs @@ -172,6 +172,8 @@ struct CountersRawRow { common_fields: CommonMetricFields, #[serde(default)] count_value: f64, + #[serde(skip_serializing_if = "Option::is_none")] + record_meta: Option, } /// Parse is the trait which should be implemented for all metric types. @@ -210,6 +212,12 @@ impl Parse for CountersRawRow { } let retention_days = enforce_retention(Some(from.retention_days), &config.env_config); + let record_meta = match from.use_case_id.as_str() { + "escalating_issues" => Some(0), + "metric_stats" => Some(0), + _ => Some(1), + }; + let common_fields = CommonMetricFields { use_case_id: from.use_case_id, org_id: from.org_id, @@ -230,6 +238,7 @@ impl Parse for CountersRawRow { Ok(Some(Self { common_fields, count_value, + record_meta, })) } } @@ -726,6 +735,7 @@ mod tests { day_retention_days: None, }, count_value: 1.0, + record_meta: Some(1), }; assert_eq!( result.unwrap(), diff --git a/rust_snuba/src/processors/snapshots/rust_snuba__processors__tests__schemas@snuba-generic-metrics-GenericCountersMetricsProcessor-snuba-generic-metrics__1__snuba-generic-metrics1.json.snap b/rust_snuba/src/processors/snapshots/rust_snuba__processors__tests__schemas@snuba-generic-metrics-GenericCountersMetricsProcessor-snuba-generic-metrics__1__snuba-generic-metrics1.json.snap index f701204a04..99b76ee498 100644 --- a/rust_snuba/src/processors/snapshots/rust_snuba__processors__tests__schemas@snuba-generic-metrics-GenericCountersMetricsProcessor-snuba-generic-metrics__1__snuba-generic-metrics1.json.snap +++ b/rust_snuba/src/processors/snapshots/rust_snuba__processors__tests__schemas@snuba-generic-metrics-GenericCountersMetricsProcessor-snuba-generic-metrics__1__snuba-generic-metrics1.json.snap @@ -17,6 +17,7 @@ expression: snapshot_payload "min_retention_days": 90, "org_id": 1, "project_id": 3, + "record_meta": 1, "retention_days": 90, "tags.indexed_value": [ 0,