feat(telemetry): align transport spans with semconv#123
Conversation
yordis
commented
Apr 13, 2026
- Align transport-level telemetry with OpenTelemetry semantic conventions so HTTP ingress and NATS messaging can be queried consistently across services.
- Reduce span attribute drift by centralizing shared telemetry keys instead of letting boundary instrumentation diverge over time.
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 34 minutes and 2 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdded OpenTelemetry-based HTTP and NATS messaging instrumentation: new Changes
Sequence DiagramsequenceDiagram
participant Client
participant Instrument as InstrumentRouter
participant Router
participant Handler
participant Telemetry as OpenTelemetry
Client->>Instrument: HTTP Request
activate Instrument
Instrument->>Telemetry: Create span "http.server.request"
Instrument->>Instrument: Set request attributes (method, path, host, user-agent, proto)
Instrument->>Router: Forward request
activate Router
Router->>Handler: Invoke handler
activate Handler
Handler-->>Router: Response
deactivate Handler
Router-->>Instrument: Response
deactivate Router
Instrument->>Telemetry: Set response attributes (status)
Instrument-->>Client: HTTP Response
deactivate Instrument
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR SummaryMedium Risk Overview Adds a new Enhances Reviewed by Cursor Bugbot for commit 50169b8. Bugbot is set up for automated code reviews on this repo. Configure here. |
Code Coverage SummaryDetailsDiff against mainResults for commit: 50169b8 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a937e3e. Configure here.
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rsworkspace/crates/trogon-nats/src/messaging.rs`:
- Around line 83-89: The deserialize error handler around
serde_json::from_slice(&response.payload) in messaging.rs currently logs the
full raw payload; instead, avoid emitting raw bodies by changing the
tracing::error call in that closure (and keep set_span_error(&span,
MessagingError::Deserialize)) to log only safe metadata: the payload length, a
truncated/sanitized preview (e.g., first N UTF-8-safe characters or hex of first
N bytes), and the error; reference the serde_json::from_slice call and the
tracing::error invocation and replace the raw payload_str with a redacted
preview and payload.len() to prevent leaking tokens/PII or huge binary blobs.
In `@rsworkspace/crates/trogon-std/Cargo.toml`:
- Around line 34-35: The Tower dependency in Cargo.toml needs the `util` feature
enabled so the test in trogon-std/src/telemetry/http.rs that imports
`tower::ServiceExt` will compile; update the `tower = "0.5"` entry to include
the util feature (e.g., add features = ["util"]) so the extension trait is
enabled for tests and downstream consumers.
In `@rsworkspace/crates/trogon-std/src/telemetry/http.rs`:
- Around line 23-27: The HTTP ingress span created in tracing::info_span!
("http.server.request" in this file) must include the OpenTelemetry kind tag so
it exports as a server span; update the span creation for method/path to also
set otel.kind = "server" (i.e., add otel.kind = "server" as a field in the
info_span! invocation that constructs the request span) so the span is marked as
a server-side request for OTel exporters.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0d6304ed-0759-4a61-9a6b-d32b2ccfdd63
⛔ Files ignored due to path filters (1)
rsworkspace/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (14)
rsworkspace/Cargo.tomlrsworkspace/crates/acp-nats-ws/Cargo.tomlrsworkspace/crates/acp-nats-ws/src/main.rsrsworkspace/crates/trogon-gateway/Cargo.tomlrsworkspace/crates/trogon-gateway/src/main.rsrsworkspace/crates/trogon-nats/Cargo.tomlrsworkspace/crates/trogon-nats/src/lib.rsrsworkspace/crates/trogon-nats/src/messaging.rsrsworkspace/crates/trogon-nats/src/telemetry/messaging.rsrsworkspace/crates/trogon-nats/src/telemetry/mod.rsrsworkspace/crates/trogon-std/Cargo.tomlrsworkspace/crates/trogon-std/src/lib.rsrsworkspace/crates/trogon-std/src/telemetry/http.rsrsworkspace/crates/trogon-std/src/telemetry/mod.rs
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
