diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go index 1b60f058b..e1f1f1d4b 100644 --- a/internal/gateway/gateway.go +++ b/internal/gateway/gateway.go @@ -106,7 +106,7 @@ func (ga *ceGateway) receive(ctx context.Context, event v2.Event) (re *v2.Event, ctx, span := ga.tracer.Start(ctx, "receive") defer span.End() - event.SetExtension("spancontext", ctx) + event.SetExtension("traceid", span.SpanContext().TraceID().String()) span.SetName("EventTracing") span.SetAttributes(attribute.String("event_id", event.ID())) span.AddEvent("received from source", trace.WithTimestamp(time.Now())) diff --git a/internal/trigger/reader/reader.go b/internal/trigger/reader/reader.go index 0d031c132..f8c0984ea 100644 --- a/internal/trigger/reader/reader.go +++ b/internal/trigger/reader/reader.go @@ -240,14 +240,14 @@ func (elReader *eventlogReader) newSpan(ctx context.Context, event ce.Event) (co if event.Extensions() == nil { return elReader.config.Tracer.Start(ctx, event.ID()) } - if _, ok := event.Extensions()["spancontext"]; !ok { + if _, ok := event.Extensions()["traceid"]; !ok { return elReader.config.Tracer.Start(ctx, event.ID()) } - var spanCtx context.Context - if err := event.ExtensionAs("spancontext", &spanCtx); err != nil { - return elReader.config.Tracer.Start(ctx, event.ID()) - } - return elReader.config.Tracer.Start(spanCtx, event.ID()) + traceid, _ := trace.TraceIDFromHex(event.Extensions()["traceid"].(string)) + _ctx := trace.ContextWithSpanContext(ctx, trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: traceid, + })) + return elReader.config.Tracer.Start(_ctx, event.ID()) } func (elReader *eventlogReader) putEvent(ctx context.Context, event info.EventRecord) error {