-
Couldn't load subscription status.
- Fork 51
Description
Preface
I noticed that while AWS is Otel-compatible, it does not (yet?) support W3C TraceContext for propagation, which is the default used in Otel. Instead, to support it in my Otel Tracer, I need to add an additional propagator (Injector/Extractor) for AWS X-Ray's TraceID format and an IDGenerator to generate trace ids in X-Ray format.
While implementing this inside OpenTelemetryTracer I first thought about defining a new protocol called OpenTelemetryTraceContextPropagator mirroring Instrument, which requires both inject & extract methods.
protocol OpenTelemetryTraceContextPropagator {
func extract<Carrier, Extract>(_ carrier: Carrier, into baggage: inout Baggage, using extractor: Extract)
where Extract: Extractor, Extract.Carrier == Carrier
func inject<Carrier, Inject>(_ baggage: Baggage, into carrier: inout Carrier, using injector: Inject)
where Inject: Injector, Inject.Carrier == Carrier
}Adding a Propagator protocol
As mentioned above, the Propagator protocol I defined mirrored our Instrument protocol exactly. One option would've been to conform my AWSXrayProtopagator to Instrument instead of defining my own type, but that feels somewhat weird as it's not a full-fletched cross-cutting-tool.
This leads me to believe that we might want to introduce a first-class Propagator protocol (that could be "inherited" by the Instrument protocol).