While reviewing open-telemetry/otel-arrow#3600 (Geneva exporter attribute-based event/table-name routing), @lalitb noted two performance follow-ups in the Geneva uploader routing code. Both paths perform an unnecessary allocation/copy where the borrow could be preserved.
1. EventName log routing copies the borrowed event name only to perform the map lookup
routing.rs:363
The event name is already borrowed, but it is copied solely to perform the events map lookup. The lookup can be done against the borrowed &str (HashMap::get accepts &str via Borrow), avoiding the allocation.
2. Span passthrough routing copies source_value even though it already borrows from the span
routing.rs:164
In the span passthrough path, source_value is copied even though it already borrows from the span. The borrow should be preservable here as well.
Note
The log-attribute routing path is different and may still need ownership, because the pdata view value is a temporary — so it should be evaluated separately.
Suggested work
- Preserve the borrow in both paths above (avoid the copy), keeping the API behavior identical.
- Confirm the log-attribute path genuinely requires ownership (temporary pdata view value) and document why if so.
Filed as a tracking follow-up per PR review discussion; non-blocking for otel-arrow#3600.
While reviewing open-telemetry/otel-arrow#3600 (Geneva exporter attribute-based event/table-name routing), @lalitb noted two performance follow-ups in the Geneva uploader routing code. Both paths perform an unnecessary allocation/copy where the borrow could be preserved.
1.
EventNamelog routing copies the borrowed event name only to perform the map lookuprouting.rs:363The event name is already borrowed, but it is copied solely to perform the
eventsmap lookup. The lookup can be done against the borrowed&str(HashMap::getaccepts&strviaBorrow), avoiding the allocation.2. Span passthrough routing copies
source_valueeven though it already borrows from the spanrouting.rs:164In the span passthrough path,
source_valueis copied even though it already borrows from the span. The borrow should be preservable here as well.Note
The log-attribute routing path is different and may still need ownership, because the pdata view value is a temporary — so it should be evaluated separately.
Suggested work
Filed as a tracking follow-up per PR review discussion; non-blocking for otel-arrow#3600.