open-telemetry / opentelemetry-specification

Specifications for OpenTelemetry
https://opentelemetry.io
Apache License 2.0
3.75k stars 889 forks source link

Context and baggage propagation over Queues is loosely defined #2516

Open oxeye-nikolay opened 2 years ago

oxeye-nikolay commented 2 years ago

I am looking into creating instrumentation in python that will propagate traces over SQS messages. I have begun looking into the specification and noticed that the context propagation way is loosely defined. Therefore I have decided to look into how was it implemented in other languages. I looked into ruby and nodejs.

I noticed that both set up to 10 attributes, to comply with SQS's attributes requirements. This, however, means that a message can be sent with partial context. Also, there are additional rules to SQS's MessageAttributes (like Can't start with AWS. or Amazon. (or any casing variations)) that are not being enforced.

It seems that there is no specification defined that settles exactly how should this information be propagated over messages and takes into consideration limits from queue systems like this. I would expect to see an explicit definition in the spec, naming the exact headers that appear in the message attributes.

pyohannes commented 2 years ago

This is something we have been actively discussing in the messaging workgroup (meeting weekly Thursdays 8am PST).

In the OTEP we are currently working on we explicitly state basic requirements for context propagation, without going into details of how those requirements can be met for every single messaging system or protocol.

Those details will be a future work item, as laid out in the same draft document. It is not even clear yet whether these details should be part of OpenTelemetry semantic conventions. For example, for AMQP and MQTT there are W3C draft documents specifying mechanisms for propagating context.

reyang commented 2 years ago

@oxeye-nikolay I think this belongs to spec:trace instead of spec:protocol?

oxeye-nikolay commented 2 years ago

@oxeye-nikolay I think this belongs to spec:trace instead of spec:protocol?

You're right @reyang . My bad

pyohannes commented 2 years ago

This is partly covered by #2750, which lays out general requirements for context propagation in messaging scenarios.

As mentioned in a comment above, this doesn't go into details of how those requirements can be met for every single messaging system or protocol.