Skip to content

Commit

Permalink
fix(agent): trace propagation (#3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathnogueira authored Sep 12, 2023
1 parent 87c20b3 commit 467019d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions agent/workers/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})

Expand Down
10 changes: 2 additions & 8 deletions agent/workers/trigger/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions agent/workers/trigger/instrument.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions agent/workers/trigger/triggerer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

type Options struct {
TraceID trace.TraceID
SpanID trace.SpanID
TestID id.ID
}

Expand Down

0 comments on commit 467019d

Please sign in to comment.