mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
chore: ignore traces from (*API).workspaceAgentCoordinate
after accept (#4178)
This commit is contained in:
@ -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 {
|
||||
|
@ -364,8 +364,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, "")
|
||||
|
Reference in New Issue
Block a user