Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions coderd/tracing/util.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package tracing

import (
"context"
"runtime"
"strings"

"go.opentelemetry.io/otel/trace"
)

var NoopSpan trace.Span

func init() {
tracer := trace.NewNoopTracerProvider().Tracer("")
_, NoopSpan = tracer.Start(context.Background(), "")
}

const TracerName = "coderd"

func FuncName() string {
Expand Down
5 changes: 4 additions & 1 deletion coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,11 @@ func (api *API) workspaceAgentCoordinate(rw http.ResponseWriter, r *http.Request
return
}

// end span so we don't get long lived trace data
// End span so we don't get long lived trace data.
tracing.EndHTTPSpan(r, http.StatusOK, trace.SpanFromContext(ctx))
// Ignore all trace spans after this.
ctx = trace.ContextWithSpan(ctx, tracing.NoopSpan)

api.Logger.Info(ctx, "accepting agent", slog.F("resource", resource), slog.F("agent", workspaceAgent))

defer conn.Close(websocket.StatusNormalClosure, "")
Expand Down