Skip to content

Commit c4d7ca7

Browse files
committed
remove attributes instead of just type/value
1 parent 1632a30 commit c4d7ca7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,20 @@ fn process_attribute_types(ourlog: &mut OurLog) {
154154
(Annotated(Some(Double), _), Annotated(Some(Value::U64(_)), _)) => (),
155155
(Annotated(Some(Double), _), Annotated(Some(Value::F64(_)), _)) => (),
156156
(Annotated(Some(String), _), Annotated(Some(Value::String(_)), _)) => (),
157-
(Annotated(ty_opt @ Some(Unknown(_)), ty_meta), _) => {
158-
ty_meta.add_error(ErrorKind::InvalidData);
159-
ty_meta.set_original_value(ty_opt.take());
157+
// Note: currently the mapping to Kafka requires that invalid or unknown combinations
158+
// of types and values are removed from the mapping.
159+
//
160+
// Usually Relay would only modify the offending values, but for now, until there
161+
// is better support in the pipeline here, we need to remove the entire attribute.
162+
(Annotated(Some(Unknown(_)), _), _) => {
163+
let original = attribute.value_mut().take();
164+
attribute.meta_mut().add_error(ErrorKind::InvalidData);
165+
attribute.meta_mut().set_original_value(original);
160166
}
161-
(Annotated(Some(_), _), Annotated(value @ Some(_), value_meta)) => {
162-
value_meta.add_error(ErrorKind::InvalidData);
163-
value_meta.set_original_value(value.take());
167+
(Annotated(Some(_), _), Annotated(Some(_), _)) => {
168+
let original = attribute.value_mut().take();
169+
attribute.meta_mut().add_error(ErrorKind::InvalidData);
170+
attribute.meta_mut().set_original_value(original);
164171
}
165172
(Annotated(None, _), _) | (_, Annotated(None, _)) => {
166173
let original = attribute.value_mut().take();

tests/integration/test_ourlogs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def test_ourlog_extraction_with_sentry_logs(
152152
"sentry.severity_text": {"value": "info", "type": "string"},
153153
"unknown_type": {"value": "info", "type": "unknown"},
154154
"broken_type": {"value": "info", "type": "not_a_real_type"},
155+
"mismatched_type": {"value": "some string", "type": "boolean"},
155156
"valid_string_with_other": {
156157
"value": "test",
157158
"type": "string",

0 commit comments

Comments
 (0)