Skip to content

Commit b310b78

Browse files
committed
tag metric
1 parent 8cee12c commit b310b78

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

relay-server/src/services/processor/attachment.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub fn scrub<Group>(managed_envelope: &mut TypedEnvelope<Group>, project_info: A
8181
}
8282

8383
fn scrub_minidump(item: &mut crate::envelope::Item, config: &relay_pii::PiiConfig) {
84+
debug_assert_eq!(item.attachment_type(), Some(&AttachmentType::Minidump));
8485
let filename = item.filename().unwrap_or_default();
8586
let mut payload = item.payload().to_vec();
8687

@@ -106,9 +107,13 @@ fn scrub_minidump(item: &mut crate::envelope::Item, config: &relay_pii::PiiConfi
106107
error = &scrub_error as &dyn Error,
107108
"failed to scrub minidump",
108109
);
109-
metric!(timer(RelayTimers::AttachmentScrubbing), {
110-
processor.scrub_attachment(filename, &mut payload);
111-
})
110+
metric!(
111+
timer(RelayTimers::AttachmentScrubbing),
112+
attachment_type = "minidump",
113+
{
114+
processor.scrub_attachment(filename, &mut payload);
115+
}
116+
)
112117
}
113118
}
114119

@@ -143,9 +148,17 @@ fn scrub_attachment(item: &mut crate::envelope::Item, config: &relay_pii::PiiCon
143148
let mut payload = item.payload().to_vec();
144149

145150
let processor = PiiAttachmentsProcessor::new(config.compiled());
146-
metric!(timer(RelayTimers::AttachmentScrubbing), {
147-
processor.scrub_attachment(filename, &mut payload);
148-
});
151+
let attachment_type_tag = match item.attachment_type() {
152+
Some(t) => t.to_string(),
153+
None => "".to_owned(),
154+
};
155+
metric!(
156+
timer(RelayTimers::AttachmentScrubbing),
157+
attachment_type = &attachment_type_tag,
158+
{
159+
processor.scrub_attachment(filename, &mut payload);
160+
}
161+
);
149162

150163
item.set_payload_without_content_type(payload);
151164
}

0 commit comments

Comments
 (0)