Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(meta): Add record_meta field to counters consumer #5680

Merged
merged 5 commits into from
Mar 25, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rust_snuba/src/processors/generic_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ struct CountersRawRow {
common_fields: CommonMetricFields,
#[serde(default)]
count_value: f64,
#[serde(skip_serializing_if = "Option::is_none")]
record_meta: Option<u8>,
}

/// Parse is the trait which should be implemented for all metric types.
Expand Down Expand Up @@ -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,
Expand All @@ -230,6 +238,7 @@ impl Parse for CountersRawRow {
Ok(Some(Self {
common_fields,
count_value,
record_meta,
}))
}
}
Expand Down Expand Up @@ -726,6 +735,7 @@ mod tests {
day_retention_days: None,
},
count_value: 1.0,
record_meta: Some(1),
};
assert_eq!(
result.unwrap(),
Expand Down
Loading