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: Extract normalized dist as metric [INGEST-335] #1158

Merged
merged 5 commits into from
Dec 16, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: Add dist to unit tests
  • Loading branch information
jjbayer committed Dec 15, 2021
commit 3da4073c4364efcf162ff26972b7854e7cfc589f
7 changes: 6 additions & 1 deletion relay-server/src/metrics_extraction/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ fn extract_transaction_status(transaction: &Event) -> Option<String> {

#[cfg(feature = "processing")]
fn extract_dist(transaction: &Event) -> Option<String> {
normalize_release_dist(transaction)
let mut dist = transaction.dist.0.clone();
normalize_dist(&mut dist);
dist
}

#[cfg(feature = "processing")]
Expand Down Expand Up @@ -234,6 +236,7 @@ mod tests {
"type": "transaction",
"timestamp": "2021-04-26T08:00:00+0100",
"release": "1.2.3",
"dist": "foo ",
"environment": "fake_environment",
"transaction": "mytransaction",
"tags": {
Expand Down Expand Up @@ -320,6 +323,7 @@ mod tests {
for metric in metrics {
assert!(matches!(metric.value, MetricValue::Distribution(_)));
assert_eq!(metric.tags["release"], "1.2.3");
assert_eq!(metric.tags["dist"], "foo");
assert_eq!(metric.tags["environment"], "fake_environment");
assert_eq!(metric.tags["transaction"], "mytransaction");
assert_eq!(metric.tags["fOO"], "bar");
Expand Down Expand Up @@ -378,6 +382,7 @@ mod tests {
}

assert_eq!(duration_metric.tags.len(), 4);
assert_eq!(duration_metric.tags["release"], "1.2.3");
assert_eq!(duration_metric.tags["transaction.status"], "ok");
assert_eq!(duration_metric.tags["environment"], "fake_environment");
assert_eq!(duration_metric.tags["transaction"], "mytransaction");
Expand Down