Skip to content

Commit

Permalink
martian(context): add trace id to context.Context when wrapping marti…
Browse files Browse the repository at this point in the history
…an.Context there
  • Loading branch information
Choraden authored and mmatczuk committed Sep 7, 2023
1 parent 235e635 commit b76ca56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/martian/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"sync"
"sync/atomic"
"time"

"github.com/saucelabs/forwarder/internal/martian/log"
)

// Context provides information and storage for a single request/response pair.
Expand Down Expand Up @@ -183,7 +185,8 @@ func (ctx *Context) addToContext(rctx context.Context) context.Context {
if rctx == nil {
rctx = context.Background()
}
return context.WithValue(rctx, martianKey, ctx)
mctx := context.WithValue(rctx, martianKey, ctx)
return context.WithValue(mctx, log.TraceContextKey, ctx.ID())
}

// Session returns the session for the context.
Expand Down

0 comments on commit b76ca56

Please sign in to comment.