diff --git a/relay-event-normalization/src/eap/mod.rs b/relay-event-normalization/src/eap/mod.rs index 2b9427892de..c823c933356 100644 --- a/relay-event-normalization/src/eap/mod.rs +++ b/relay-event-normalization/src/eap/mod.rs @@ -1623,6 +1623,66 @@ mod tests { ); } + #[test] + fn test_normalize_mcp_attributes_without_network_attributes() { + let mut attributes = Attributes::new(); + attributes.insert("mcp.transport", "CustomHTTPTransport"); + attributes.insert("mcp.resource.protocol", "file"); + let mut attributes = Annotated::new(attributes); + + normalize_attribute_names(&mut attributes); + + assert_annotated_snapshot!(attributes, @r#" + { + "mcp.resource.protocol": { + "type": "string", + "value": "file" + }, + "mcp.transport": { + "type": "string", + "value": "CustomHTTPTransport" + } + } + "#); + } + + #[test] + fn test_normalize_mcp_attributes_with_network_attributes() { + let mut attributes = Attributes::new(); + attributes.insert("mcp.transport", "CustomHTTPTransport"); + attributes.insert("mcp.resource.protocol", "file"); + attributes.insert("network.transport", "quic"); + attributes.insert("net.protocol.name", "http"); + let mut attributes = Annotated::new(attributes); + + normalize_attribute_names(&mut attributes); + + assert_annotated_snapshot!(attributes, @r#" + { + "mcp.resource.protocol": { + "type": "string", + "value": "file" + }, + "mcp.transport": { + "type": "string", + "value": "CustomHTTPTransport" + }, + "net.protocol.name": { + "type": "string", + "value": "http" + }, + "network.protocol.name": { + "type": "string", + "value": "http" + }, + "network.transport": { + "type": "string", + "value": "quic" + } + } + "#); + } + #[test] fn test_normalize_attributes() { fn replace_key(fragment: &str) -> String {