fix(observability): OTel semantic attrs on access log + status on root span#240
Open
igoramf wants to merge 3 commits into
Open
fix(observability): OTel semantic attrs on access log + status on root span#240igoramf wants to merge 3 commits into
igoramf wants to merge 3 commits into
Conversation
…t span Two instrumentation gaps closed: 1. logRequest() was emitting legacy attribute names (method, path, status, duration_ms). Switch to OTel semantic convention names so tail-worker and direct-POST logs share the same attribute keys and dashboards can query either source without aliasing. 2. deco.http.request root span never received http.status_code, leaving it permanently Unset even for 5xx responses. Stamp it after the handler returns so the setAttribute promotion in otelHttpTracer triggers and 5xx spans surface as StatusCode=Error in ClickHouse. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Duration belongs on the span (startTime/endTime), not the log. The tail worker already exposes cloudflare.worker.wall_time_ms for the same purpose — having duration_ms in the direct-POST log creates a second inconsistent attribute measuring a slightly different thing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
logRequest()was emitting legacy attribute names (method,path,status,duration_ms). Now uses OTel semantic convention names (http.request.method,url.path,http.response.status_code) so tail-worker and direct-POST logs share the same attribute keys — no aliasing needed in dashboardsdeco.http.requestroot span never receivedhttp.status_code, leaving it permanentlyUnseteven for 5xx responses. Now stamps the status after the handler returns, triggering thesetAttributepromotion inotelHttpTracerso 5xx spans surface asStatusCode=Errorin ClickHouseTest plan
otel_logs—request handledlogs should havehttp.request.method,url.path,http.response.status_codeinstead ofmethod,path,statusotel_tracesfordeco.http.requestspans withSpanAttributes['http.status_code'] = '500'— should now return results withStatusCode=Error🤖 Generated with Claude Code
Summary by cubic
Standardized access logs to OpenTelemetry semantic keys and removed
duration_ms, and the rootdeco.http.requestspan now recordshttp.status_code. Uses@opentelemetry/semantic-conventionsconstants.http.request.method,url.path,http.response.status_code(replacesmethod,path,status). Droppedduration_ms.http.status_codeafter the handler returns, so 5xx spans surface asStatusCode=Error.Written for commit 9473ccf. Summary will update on new commits.