Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMQP draft: PR was moved to different repository #217

Closed
wants to merge 6 commits into from

Conversation

SergeyKanzhelev
Copy link
Member

@SergeyKanzhelev SergeyKanzhelev commented Dec 14, 2018

## Batching

TODO: Batching of messages – recommended semantics of TraceContext fields when

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a discussion and general guidance for batching, but it probably is related more to the instrumentation and tracing system behavior.

My (very small) experience with AMQP involves Azure ServiceBus and EventHubs, I can miss a lot of details here, but my take on this was:

  • SB/EH message could be represented by AMQP message. Or a batch of SB/EH messages is a single AMQP message. If it is the typical case for AMQP, we should give guidance to the AMQP implementations on how to treat these two cases.

  • every SB/EH message carry trace context - they probably were produced in different contexts under different spans. Such messages should be annotated during creation, not during publishing. This is instrumentation guidance.

  • AMQP message constructed from the batch has new trace context, potentially unrelated to each message in the batch. Relation should be established by something like opencensus links. But again this is instrumentation and tracing system details, not the protocol.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specification should define a binding to the AMQP "message format 0", i.e. the layout that is defined in the Messaging section of the the AMQP spec, but should not go into further detail on HOW those messages are being transferred.

AMQP is enormously efficient when filling link credit with sending messages in sequence without any special overlaid batching.

Service Bus and Event Hubs indeed have a special message format that can indeed batch multiple AMQP message format messages into one, but the way to bind to that format is by specifying a binding to the core message format and then have the proprietary batching model pick that up via the binding to the standard message.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been implemented anywhere?

@SergeyKanzhelev
Copy link
Member Author

@yurishkuro I'm working with Azure IoT team to implement it. Binary format for traceparent was already adopted by Open Census for GRPC.

of AMQP specification.

Property name MUST be `traceparent` - all lowercase without delimiters.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the case that the traceparent and tracestate fields are transported via message-annotations:

As for the base type of the message-annotations, the AMQP spec says (http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-annotations):

The annotations type is a map where the keys are restricted to be of type symbol or of type ulong. All ulong keys, and all symbolic keys except those beginning with "x-" are reserved. Keys beginning with "x-opt-" MUST be ignored if not understood. On receiving an annotation key which is not understood, and which does not begin with "x-opt", the receiving AMQP container MUST detach the link with a not-implemented error.

Concerning the names of message-annotations:

A registry of defined annotations and their meanings is maintained [AMQPMESSANN].

The question here: Are the names of the traceparent and tracestate fields supposed to be somehow registered as reserved with OASIS. Otherwise it looks to me as if the prefix "x-opt-" should be used.

See definition of type map in section
[1.6.23](http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html#type-map)
of AMQP specification.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the case that the traceparent and tracestate fields are transported via application-properties:

About application-properties, the AMQP spec says (http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-application-properties):

The keys of this map are restricted to be of type string (which excludes the possibility of a null key) and the values are restricted to be of simple types only, that is, excluding map, list, and array types.

This looks incompatible with wanting to store a tracestate AMQP map in there.


Strings duplicating the size of a field, using list of binaries will require to
redefine the way the field serialized, parsed, and versioned. So re-using binary
protocol looks like a logical solution.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is that 'binary protocol' defined? (I found https://w3c.github.io/trace-context/extension-binary.html but it seems to be empty?). AMQP has quite a complex type-system that will already be required to decode the message, so it might be simpler to use that to encode traceparent in some way rather than requiring further decoding of the field.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is in another PR: #215 Sorry for confusion.

@grs what type would you suggest for the header? We discussed options and didn't find the right match

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, to @calohmn's point re the restrictions on application-property values, perhaps you are right and the binary format is best (it is not very arduous to parse). (Alternatively an amqp list or a map with integer keys would be similar to the binary encoding).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grs yeah. It may be better to switch to binary protocol than. At least some consistency - either text (like HTTP or MQTT) or binary (like GRPC or AMQP).

@SergeyKanzhelev
Copy link
Member Author

@calohmn thank you for your review! I'll look into it. @clemensv I'd appreciate your input here as well.

SergeyKanzhelev pushed a commit to w3c/trace-context-amqp that referenced this pull request Feb 19, 2019
@SergeyKanzhelev SergeyKanzhelev changed the title [WIP] AMQP draft AMQP draft: PR was moved to different repository Feb 19, 2019
@SergeyKanzhelev
Copy link
Member Author

PR was moved

w3c/trace-context-amqp#1

SergeyKanzhelev added a commit to w3c/trace-context-amqp that referenced this pull request Oct 20, 2020
* moved from w3c/trace-context#217

* Update spec/20-AMQP_FORMAT.md

Co-Authored-By: SergeyKanzhelev <[email protected]>

Co-authored-by: Sergey Kanzhelev <[email protected]>
Co-authored-by: Nik Molnar <[email protected]>
@SergeyKanzhelev SergeyKanzhelev deleted the sergkanz/amqpspec branch August 5, 2021 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants