Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Deprecate old AI monitoring attributes. ([#4960](https://github.com/getsentry/relay/pull/4960))
- Normalize legacy `ai.*` attributes to `gen_ai.*` names. ([#4924](https://github.com/getsentry/relay/pull/4924))
- Force the routing key to be random instead of letting Kafka handle the randomization. ([#4974](https://github.com/getsentry/relay/pull/4974))
- Stop extracting the `sentry.severity_number` attribute for logs. ([#4989](https://github.com/getsentry/relay/pull/4989))
- Stop extracting the `sentry.trace_flags` attribute for logs. ([#4988](https://github.com/getsentry/relay/pull/4988))
- Add Jwm to the supported image types. ([#4975](https://github.com/getsentry/relay/pull/4975))

Expand Down
59 changes: 0 additions & 59 deletions relay-ourlogs/src/ourlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ pub fn ourlog_merge_otel(ourlog: &mut Annotated<OurLog>, received_at: DateTime<U
.map(|level| level.to_string())
.unwrap_or_else(|| "info".to_owned()),
);
attributes.insert(
"sentry.severity_number".to_owned(),
level_to_otel_severity_number(ourlog_value.level.value().cloned()),
);
attributes.insert(
"sentry.timestamp_nanos".to_owned(),
timestamp_nanos.to_string(),
Expand All @@ -149,20 +145,6 @@ pub fn ourlog_merge_otel(ourlog: &mut Annotated<OurLog>, received_at: DateTime<U
);
}

fn level_to_otel_severity_number(level: Option<OurLogLevel>) -> i64 {
match level {
Some(OurLogLevel::Trace) => 1,
Some(OurLogLevel::Debug) => 5,
Some(OurLogLevel::Info) => 9,
Some(OurLogLevel::Warn) => 13,
Some(OurLogLevel::Error) => 17,
Some(OurLogLevel::Fatal) => 21,
// 0 is the default value.
// https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/68e1d6cd94bfca9bdf725327d4221f97ce0e0564/pkg/stanza/docs/types/severity.md
_ => 0,
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -433,10 +415,6 @@ mod tests {
"type": "string",
"value": "946684800000000000"
},
"sentry.severity_number": {
"type": "integer",
"value": 9
},
"sentry.severity_text": {
"type": "string",
"value": "info"
Expand All @@ -454,39 +432,6 @@ mod tests {
"###);
}

#[test]
fn ourlog_merge_otel_log_with_unknown_severity_number() {
let json = r#"{
"timestamp": 946684800.0,
"level": "abc",
"trace_id": "5B8EFFF798038103D269B633813FC60C",
"span_id": "EEE19B7EC3C1B174",
"body": "Example log record",
"attributes": {
"foo": {
"value": "9",
"type": "string"
}
}
}"#;

let mut data = Annotated::<OurLog>::from_json(json).unwrap();
ourlog_merge_otel(
&mut data,
DateTime::from_timestamp_nanos(946684800000000000),
);
assert_eq!(
data.value()
.unwrap()
.attributes
.value()
.unwrap()
.get_attribute("sentry.severity_number")
.unwrap(),
&Attribute::new(AttributeType::Integer, Value::I64(0)),
);
}

#[test]
#[allow(deprecated)]
fn ourlog_merge_otel_log_with_timestamp() {
Expand Down Expand Up @@ -518,10 +463,6 @@ mod tests {
"type": "string",
"value": "946684800000000000"
},
"sentry.severity_number": {
"type": "integer",
"value": 0
},
"sentry.severity_text": {
"type": "string",
"value": "info"
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/test_ourlogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def test_ourlog_meta_attributes(
"sentry.body": {"stringValue": "oops, not again"},
"sentry.browser.name": {"stringValue": "Python Requests"},
"sentry.browser.version": {"stringValue": "2.32"},
"sentry.severity_number": {"intValue": "17"},
"sentry.severity_text": {"stringValue": "error"},
"sentry.span_id": {"stringValue": "eee19b7ec3c1b175"},
**timestamps(ts),
Expand Down Expand Up @@ -305,7 +304,6 @@ def test_ourlog_extraction_with_sentry_logs(
"span_id": "eee19b7ec3c1b174",
"level": "info",
"body": "Example log record",
"severity_number": 10,
"attributes": {
"boolean.attribute": {"value": True, "type": "boolean"},
"integer.attribute": {"value": 42, "type": "integer"},
Expand Down Expand Up @@ -333,7 +331,6 @@ def test_ourlog_extraction_with_sentry_logs(
"sentry.body": {"stringValue": "This is really bad"},
"sentry.browser.name": {"stringValue": "Python Requests"},
"sentry.browser.version": {"stringValue": "2.32"},
"sentry.severity_number": {"intValue": "17"},
"sentry.severity_text": {"stringValue": "error"},
"sentry.span_id": {"stringValue": "eee19b7ec3c1b175"},
**timestamps(ts),
Expand All @@ -360,7 +357,6 @@ def test_ourlog_extraction_with_sentry_logs(
"sentry.body": {"stringValue": "Example log record"},
"sentry.browser.name": {"stringValue": "Python Requests"},
"sentry.browser.version": {"stringValue": "2.32"},
"sentry.severity_number": {"intValue": "9"},
"sentry.severity_text": {"stringValue": "info"},
"sentry.span_id": {"stringValue": "eee19b7ec3c1b174"},
"string.attribute": {"stringValue": "some string"},
Expand Down Expand Up @@ -433,7 +429,6 @@ def test_ourlog_extraction_with_sentry_logs_with_missing_fields(
"sentry.body": {"stringValue": "Example log record 2"},
"sentry.browser.name": {"stringValue": "Python Requests"},
"sentry.browser.version": {"stringValue": "2.32"},
"sentry.severity_number": {"intValue": "13"},
"sentry.severity_text": {"stringValue": "warn"},
**timestamps(ts),
},
Expand Down Expand Up @@ -559,7 +554,6 @@ def test_browser_name_version_extraction(
"sentry.body": {"stringValue": "This is really bad"},
"sentry.browser.name": {"stringValue": expected_browser_name},
"sentry.browser.version": {"stringValue": expected_browser_version},
"sentry.severity_number": {"intValue": "17"},
"sentry.severity_text": {"stringValue": "error"},
"sentry.span_id": {"stringValue": "eee19b7ec3c1b175"},
**timestamps(ts),
Expand Down
Loading