sunny thakur
09/19/2023, 3:13 AMGO
all separate processes not using/passing any context. Lets call them J1..J5 where J1 is the root span and each Job runs sequentially.
What is the best way to pass in parent span ID
to the current job. e.g. J2 parent span id -> J1; J3 -> J2; J4 ->J3; J5 -> J4.
I am using GO Otel library and sending them to Signoz but each job is a new trace instead of 1 trace with spans.
• Also, can I generate a traceID and set it as well instead of Otel or context to do it for me? I have a Hash that I can use as a TraceID for all the spans.sunny thakur
09/19/2023, 3:13 AMSrikanth Chekuri
09/19/2023, 3:37 AMsunny thakur
09/19/2023, 4:14 PMGO
examples you can share?Srikanth Chekuri
09/20/2023, 4:09 AMsunny thakur
09/20/2023, 11:01 PMsunny thakur
09/20/2023, 11:02 PMsunny thakur
09/20/2023, 11:14 PMSrikanth Chekuri
09/21/2023, 3:15 AMimport (
"context"
"<http://go.opentelemetry.io/otel|go.opentelemetry.io/otel>"
)
carrier := make(map[string][]string)
// Should be replaced with the actual context
ctx := context.Background()
propagator := otel.GetTextMapPropagator()
propagator.Inject(ctx, carrier)
Extract
import (
"context"
"<http://go.opentelemetry.io/otel|go.opentelemetry.io/otel>"
"<http://go.opentelemetry.io/otel/propagation|go.opentelemetry.io/otel/propagation>"
)
carrier := make(map[string][]string)
propagator := otel.GetTextMapPropagator()
extractedContext := propagator.Extract(ctx, carrier)