MCPcopy Index your code
hub / github.com/github/copilot-sdk / TestToolInvocationTraceContext

Function TestToolInvocationTraceContext

go/telemetry_test.go:60–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestToolInvocationTraceContext(t *testing.T) {
61 otel.SetTextMapPropagator(propagation.TraceContext{})
62 defer otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator())
63
64 traceparent := "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
65 ctx := contextWithTraceParent(context.Background(), traceparent, "")
66
67 inv := ToolInvocation{
68 SessionID: "sess-1",
69 ToolCallID: "call-1",
70 ToolName: "my_tool",
71 Arguments: nil,
72 TraceContext: ctx,
73 }
74
75 // The TraceContext should carry the remote span context
76 sc := trace.SpanContextFromContext(inv.TraceContext)
77 if !sc.IsValid() {
78 t.Fatal("expected valid span context on ToolInvocation.TraceContext")
79 }
80 if sc.TraceID().String() != "4bf92f3577b34da6a3ce929d0e0e4736" {
81 t.Errorf("unexpected trace ID: %s", sc.TraceID())
82 }
83 if sc.SpanID().String() != "00f067aa0ba902b7" {
84 t.Errorf("unexpected span ID: %s", sc.SpanID())
85 }
86}

Callers

nothing calls this directly

Calls 2

contextWithTraceParentFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…