feat(server): standard HTTP + tenant attributes on the query span (§3.5) - #625
Conversation
RFC 0038 §3.5 specifies the `POST /v1/query` SERVER span carrying the standard HTTP server attributes plus the tenant it scoped to, but the span only carried `otel.kind`. Add them: `http.request.method` (POST) and `http.route` (/v1/query) as static fields, `ourios.tenant` recorded once the tenant is resolved, and `http.response.status_code` captured at the single exit — the handler body moves to an inner fn so every early-return path's status lands on the span (mirrors the mcp.rs `_traced` pattern). `http.response.status_code` is recorded as `i64`, not `u16`: `tracing-opentelemetry` stringifies `u64` (OTel has no unsigned type), and semconv types the attribute as an int. All four are stable/registered semconv (no live-check exemption). Verified locally against `weaver registry live-check`: the query span carries all four and the emitted telemetry has zero non-exempt violations. The RFC0038.1 query-span test now asserts them. Signed-off-by: Jens Holdgaard Pedersen <Jens@holdgaard.org>
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ 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 |
There was a problem hiding this comment.
Pull request overview
Implements RFC 0038 §3.5 for the querier’s POST /v1/query SERVER span by adding the standard HTTP server semantic-convention attributes plus the resolved tenant, and ensuring the response status code is recorded on the single exit path.
Changes:
- Enriches the query handler span with
http.request.method,http.route,ourios.tenant, andhttp.response.status_codeattributes (recording tenant/status once known). - Refactors the handler into an outer traced wrapper + inner body so all early-return paths still result in the status code being captured on the span.
- Updates the RFC0038.1 integration test to assert the presence and values/types of the four attributes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/ourios-server/src/querier.rs | Adds the RFC0038 §3.5 HTTP+tenant attributes to the query SERVER span and records the response status code at the single exit. |
| crates/ourios-server/tests/it/rfc0038_1_request_spans.rs | Extends the query-span integration test to assert the four required span attributes and their values/types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What
RFC 0038 §3.5 specifies the
POST /v1/querySERVER span carrying the standard HTTP server attributes plus the tenant it scoped to, but the span only carriedotel.kind. This adds them:http.request.methodPOST(static)http.route/v1/query(static)ourios.tenanthttp.response.status_codeThe handler body moves to an inner fn so every early-return path's status is captured on the span (the same
_traced-delegate pattern used for the MCP tool spans).Why
i64, notu16http.response.status_codeis recorded asi64:tracing-opentelemetrystringifiesu64(OTel has no unsigned value type), which would emit the status as a string and violate semconv (the attribute is typedint).i64::from(status.as_u16())records via the int path.semconv
All four attributes are stable/registered —
http.*are stable core semconv andourios.tenantis already insemconv/registry/attributes.yaml. No live-check exemption needed (unlike the relocatedgen_ai.*/mcp.*in #623).Verification
cargo fmt --all --check,cargo clippy --all-targets --all-features -D warnings,cargo test -p ourios-server(all suites) — green.weaver registry live-check: thePOST /v1/queryspan carries all four attributes and the emitted telemetry has zero non-exempt violations (the new attributes are all conformant).rfc0038_1_request_spans.rs) now asserts the four attribute values.Follow-up (not in scope here): §3.5 also lists
ourios.tenanton the MCP spans and record/tenant counts on the ingest-batch and sweep spans — separate small gaps.