Skip to content

Commit ecfafa8

Browse files
committed
ref(ratelimits): Count a transaction also as a span
1 parent c28f9da commit ecfafa8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

relay-server/src/envelope/item.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ impl Item {
106106

107107
match self.ty() {
108108
ItemType::Event => smallvec![(DataCategory::Error, item_count)],
109-
ItemType::Transaction => smallvec![(DataCategory::Transaction, item_count)],
109+
ItemType::Transaction => smallvec![
110+
(DataCategory::Transaction, item_count),
111+
(DataCategory::Span, item_count)
112+
],
110113
ItemType::Security | ItemType::RawSecurity => {
111114
smallvec![(DataCategory::Security, item_count)]
112115
}

relay-server/src/services/projects/cache/project.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,7 @@ fn count_nested_spans(envelope: &ManagedEnvelope) -> usize {
178178
.items()
179179
.find(|item| *item.ty() == ItemType::Transaction && !item.spans_extracted())
180180
.and_then(|item| serde_json::from_slice::<PartialEvent>(&item.payload()).ok())
181-
// We do + 1, since we count the transaction itself because it will be extracted
182-
// as a span and counted during the slow path of rate limiting.
183-
.map_or(0, |event| event.spans.0 + 1)
181+
.map_or(0, |event| event.spans.0)
184182
}
185183

186184
#[cfg(test)]

0 commit comments

Comments
 (0)