forked from mtusi2026/mtusi2026lab6
feat(outbox): lab6 persist W3C trace context with attachment jobs
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package telemetry
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
)
|
||||
|
||||
// TraceHeaders переносит только W3C Trace Context через границу задания.
|
||||
func TraceHeaders(ctx context.Context) map[string]string {
|
||||
headers := propagation.MapCarrier{}
|
||||
propagation.TraceContext{}.Inject(ctx, headers)
|
||||
return headers
|
||||
}
|
||||
|
||||
func ExtractTrace(ctx context.Context, headers map[string]string) context.Context {
|
||||
return propagation.TraceContext{}.Extract(ctx, propagation.MapCarrier(headers))
|
||||
}
|
||||
Reference in New Issue
Block a user