Skip to content

tracing incoming requests #3891

Open
Open
@seanl-circle

Description

@seanl-circle

Context and scope

avalanchego currently has some support for tracing, but it's disconnected from incoming / outgoing requests for upstream / downstream services.

I'd like to have the traces from our clients be propagated through avalanchego

Discussion and alternatives

I believe this requires a few changes:

Changing the sampler to sdktrace.ParentBased(sdktrace.TraceIDRatioBased(...))

sdktrace.WithSampler(sdktrace.TraceIDRatioBased(config.TraceSampleRate)),

Setting a TextMapPropagator https://pkg.go.dev/go.opentelemetry.io/otel#SetTextMapPropagator
(use TraceContext + baggage https://pkg.go.dev/go.opentelemetry.io/otel@v1.35.0/propagation#TraceContext )

using the textmappropagator to pull trace parents / sampling decisions from incoming requests
typically this uses https://pkg.go.dev/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp#NewHandler
but it should also be possible to do manually in

ctx, span := h.tracer.Start(ctx, h.serveHTTPTag, oteltrace.WithAttributes(

Open questions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog 🧊

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions