diff --git a/agent/workers/trigger.go b/agent/workers/trigger.go index 5a66c3e5ea..938550f821 100644 --- a/agent/workers/trigger.go +++ b/agent/workers/trigger.go @@ -44,6 +44,7 @@ func (w *TriggerWorker) Trigger(ctx context.Context, triggerRequest *proto.Trigg response, err := triggerer.Trigger(ctx, triggerConfig, &agentTrigger.Options{ TraceID: traceID, + SpanID: id.NewRandGenerator().SpanID(), TestID: id.ID(triggerRequest.TestID), }) diff --git a/agent/workers/trigger/http.go b/agent/workers/trigger/http.go index b31eb26494..9091a1b011 100644 --- a/agent/workers/trigger/http.go +++ b/agent/workers/trigger/http.go @@ -40,14 +40,8 @@ func httpClient(sslVerification bool) http.Client { func newSpanContext(ctx context.Context) trace.SpanContext { spanCtx := trace.SpanContextFromContext(ctx) - var ( - tid trace.TraceID - sid trace.SpanID - ) - if spanCtx.IsValid() { - tid = spanCtx.TraceID() - sid = spanCtx.SpanID() - } + tid := spanCtx.TraceID() + sid := spanCtx.SpanID() tracestate, _ := trace.ParseTraceState("tracetest=true") var tf trace.TraceFlags diff --git a/agent/workers/trigger/instrument.go b/agent/workers/trigger/instrument.go index 12aa983700..55f1755384 100644 --- a/agent/workers/trigger/instrument.go +++ b/agent/workers/trigger/instrument.go @@ -45,6 +45,7 @@ func (t *instrumentedTriggerer) Trigger(ctx context.Context, triggerConfig trigg if opts != nil { spanContextConfig.TraceID = opts.TraceID + spanContextConfig.SpanID = opts.SpanID } spanContext := trace.NewSpanContext(spanContextConfig) diff --git a/agent/workers/trigger/triggerer.go b/agent/workers/trigger/triggerer.go index a3fc2b0e49..dc3dda2851 100644 --- a/agent/workers/trigger/triggerer.go +++ b/agent/workers/trigger/triggerer.go @@ -13,6 +13,7 @@ import ( type Options struct { TraceID trace.TraceID + SpanID trace.SpanID TestID id.ID }