davsclaus opened a new pull request, #24606: URL: https://github.com/apache/camel/pull/24606
## Summary When `camel-telemetry` (via `--observe` or explicit dependency) is active alongside BacklogTracer activity tracking, this PR enriches activity endpoint-send entries with component-specific span decorator attributes — without running decorator logic twice. ### Design - **`RecordingSpan`** wraps the real `Span` and intercepts `setTag()`/`setComponent()` calls, building a `Map<String, String>` alongside the real span. The decorator code is completely unaware of the wrapping. - **`Tracer.beginEventSpan()`** conditionally wraps the span only when `BacklogTracer.isActivityEnabled()` returns `true` and the operation is `EVENT_SENT`. After the decorator runs, the recorded tags are stored on the exchange via `ExchangePropertyKey.ACTIVITY_SPAN_TAGS`. - **Zero overhead in production**: the `activityEnabled` boolean defaults to `false`. No wrapping, no Map allocation, no exchange property writes unless activity is explicitly enabled. ### What the BacklogTracer side picks up (in PR #24598) The `onExchangeSent` handler reads `ExchangePropertyKey.ACTIVITY_SPAN_TAGS` from the exchange and attaches it to each `EndpointSend` entry. This gives activity data rich details like: - **Kafka**: topic, partition, offset, key - **SQL**: db.system, db.statement - **HTTP**: method, status code - **General**: server.address, server.protocol ### Files changed - **`Exchange.java`** — new `ACTIVITY_SPAN_TAGS` constant - **`ExchangePropertyKey.java`** — enum entry + switch case - **`BacklogTracer.java`** — `isActivityEnabled()` default method - **`RecordingSpan.java`** (new) — Span wrapper that records setTag calls - **`Tracer.java`** — conditional wrapping in `beginEventSpan()`, activity detection in `doInit()` ### Dependency This PR provides the **telemetry side** of the enrichment. The **consumer side** (BacklogTracer reading the exchange property) will be added in PR #24598. ## Test plan - [ ] Verify `camel-telemetry` module compiles - [ ] Verify `camel-api` module compiles - [ ] Integration test: with `--observe` and activity enabled, confirm span tags appear on exchange property after `ExchangeSentEvent` - [ ] Verify no span wrapping occurs when activity is disabled (production path) _Claude Code on behalf of davsclaus_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
