Skip to content

Commit

Permalink
add ability to append/extract tracing context
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Martinez committed Sep 24, 2019
1 parent 4478963 commit 275030c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions support/trace/context.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package trace

import "context"

type key struct{}
var id = key{}

func AppendTracingContext(goCtx context.Context, tracingContext interface{}) context.Context {
return context.WithValue(goCtx, id, tracingContext)
}

func ExtractTracingContext(goCtx context.Context) interface{} {
return goCtx.Value(id)
}

0 comments on commit 275030c

Please sign in to comment.