Skip to content

feat(server): standard HTTP + tenant attributes on the query span (§3.5) - #625

Merged
jensholdgaard merged 1 commit into
mainfrom
rfc0038-query-span-http-attrs
Jul 24, 2026
Merged

feat(server): standard HTTP + tenant attributes on the query span (§3.5)#625
jensholdgaard merged 1 commit into
mainfrom
rfc0038-query-span-http-attrs

Conversation

@jensholdgaard

Copy link
Copy Markdown
Owner

What

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. This adds them:

Attribute Value
http.request.method POST (static)
http.route /v1/query (static)
ourios.tenant the resolved tenant (recorded once known)
http.response.status_code the outgoing status, captured at the single exit

The 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, not u16

http.response.status_code is recorded as i64: tracing-opentelemetry stringifies u64 (OTel has no unsigned value type), which would emit the status as a string and violate semconv (the attribute is typed int). i64::from(status.as_u16()) records via the int path.

semconv

All four attributes are stable/registered — http.* are stable core semconv and ourios.tenant is already in semconv/registry/attributes.yaml. No live-check exemption needed (unlike the relocated gen_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.
  • Local weaver registry live-check: the POST /v1/query span carries all four attributes and the emitted telemetry has zero non-exempt violations (the new attributes are all conformant).
  • The RFC0038.1 query-span test (rfc0038_1_request_spans.rs) now asserts the four attribute values.

Follow-up (not in scope here): §3.5 also lists ourios.tenant on the MCP spans and record/tenant counts on the ingest-batch and sweep spans — separate small gaps.

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>
@jensholdgaard
jensholdgaard requested a review from Copilot July 24, 2026 18:25
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jensholdgaard, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7018c911-7fea-47a8-8e7d-28f3a6462b3d

📥 Commits

Reviewing files that changed from the base of the PR and between ada046b and 0b0348b.

📒 Files selected for processing (2)
  • crates/ourios-server/src/querier.rs
  • crates/ourios-server/tests/it/rfc0038_1_request_spans.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc0038-query-span-http-attrs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and http.response.status_code attributes (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.

@jensholdgaard
jensholdgaard merged commit f4da161 into main Jul 24, 2026
27 checks passed
@jensholdgaard
jensholdgaard deleted the rfc0038-query-span-http-attrs branch July 24, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants