filter attributes on info or higher level

This commit is contained in:
Adil Hafeez 2026-02-09 12:00:10 -08:00
parent 5c93c8f9c1
commit acb3edf5ff
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
2 changed files with 7 additions and 2 deletions

View file

@ -124,11 +124,15 @@ impl SpanExporter for ServiceNameOverrideExporter {
// Group spans by their effective service name
let mut spans_by_service: HashMap<String, Vec<SpanData>> = HashMap::new();
let should_filter = !tracing::enabled!(tracing::Level::DEBUG);
for span in batch {
let mut span = span;
span.attributes
.retain(|kv| !FILTERED_ATTR_KEYS.contains(&kv.key.as_str()));
if should_filter {
span.attributes
.retain(|kv| !FILTERED_ATTR_KEYS.contains(&kv.key.as_str()));
}
let service_name = span
.attributes