[log] Add debug logging to tracing/http.go WrapHTTPHandler#3206
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[log] Add debug logging to tracing/http.go WrapHTTPHandler#3206github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Add meaningful debug log calls to WrapHTTPHandler using the existing logTracing logger (declared in provider.go, same package): - Log at handler registration time: span name and extra attribute count - Log per-request: span name, HTTP method/path, and whether a W3C remote parent trace context was extracted from incoming headers - Log after span creation: span name and trace ID for correlation These logs are only emitted when DEBUG matches 'tracing:provider' or a wildcard pattern, adding zero overhead in production. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Adds 4 meaningful debug log calls to
internal/tracing/http.gousing the existinglogTracinglogger declared inprovider.go(sametracingpackage, no new logger declaration needed).Changes
File:
internal/tracing/http.goThree categories of debug log calls added to
WrapHTTPHandler:Handler registration — logs when a handler is wired up with its OTel span name and the number of extra attributes:
Per-request entry — logs the span name, HTTP method, path, and whether an incoming W3C
traceparentheader was found (i.e., whether this is a continuation of a distributed trace or a fresh root trace):Post-span-start — logs the generated or propagated trace ID for cross-system correlation:
No Side Effects
logTracingis already declared inprovider.goin the same package — no new logger variable addedoteltrace.SpanContextFromContext(ctx).IsRemote()is a pure read with no side effectsspan.SpanContext().TraceID()is a pure read; formats to hex via%sDEBUG=tracing:*orDEBUG=*— zero overhead when disabledQuality Checklist
logTracinglogger (no duplicate declaration)pkg:filenameconvention (tracing:provider)Note
🔒 Integrity filter blocked 1 item
The following item were blocked because they don't meet the GitHub integrity level.
search_code: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".To allow these resources, lower
min-integrityin your GitHub frontmatter: