Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/tracing/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ import (
// GitHub API proxy. Callers that need session-level attributes (e.g. session.id)
// should add them as extra attrs or extend the context themselves.
func WrapHTTPHandler(next http.Handler, spanName string, extraAttrs ...attribute.KeyValue) http.Handler {
logTracing.Printf("Registering HTTP handler with OTel span: span=%s, extraAttrs=%d", spanName, len(extraAttrs))
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

These new logs in http.go use logTracing which is namespaced as tracing:provider, so enabling/disabling debug output becomes misleading and you can’t selectively turn on tracing:http without also turning on provider logs. Elsewhere in the repo loggers are per-file/module (e.g. proxy:handler in internal/proxy/handler.go:24, proxy:graphql in internal/proxy/graphql.go:11); consider defining a tracing:http logger in this file and using it for request/handler logs.

Copilot uses AI. Check for mistakes.
t := Tracer()
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Extract incoming W3C trace context (traceparent / tracestate).
// If the headers are absent the returned ctx is unchanged and OTEL
// will generate a fresh trace ID when the span is started.
ctx := otel.GetTextMapPropagator().Extract(r.Context(), propagation.HeaderCarrier(r.Header))

hasRemoteParent := oteltrace.SpanContextFromContext(ctx).IsRemote()
logTracing.Printf("Handling request: span=%s, method=%s, path=%s, remoteParent=%v", spanName, r.Method, r.URL.Path, hasRemoteParent)

attrs := append([]attribute.KeyValue{
attribute.String("http.method", r.Method),
attribute.String("http.path", r.URL.Path),
Expand All @@ -41,6 +45,8 @@ func WrapHTTPHandler(next http.Handler, spanName string, extraAttrs ...attribute
)
defer span.End()

logTracing.Printf("Span started: span=%s, traceID=%s", spanName, span.SpanContext().TraceID())

next.ServeHTTP(w, r.WithContext(ctx))
})
}
Loading