(t *testing.T)
| 58 | } |
| 59 | |
| 60 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…