census-instrumentation / opencensus-specs

Apache License 2.0
188 stars 50 forks source link

FR: Trace and Tag propagation convenience for message-based systems #265

Open deanberris opened 5 years ago

deanberris commented 5 years ago

In census-instrumentation/opencensus-java#1013 there's an implementation of convenience functions and types for imbuing/reconstituting tags and trace information in messages meant to be processed asynchronously. As more "serverless" or "event-driven" architectures start relying on non-RPC mechanisms for triggering work, it makes a lot of sense to be able to consistently do this across the programming languages.

If we can make it so that we support more types of messages than those used in traditional message bus/broker mediated systems, then that would be better. There's census-instrumentation/opencensus-specs#228 for Kafka messages, but the problem and design space is more general. This applies to some more message types:

This may make it necessary to ensure all language implementations have a consistent way of marshalling/un-marshalling messages that are encoded in whatever message format. Java seems to already have an implementation for supporting Google Cloud Pub/Sub messages, it might make sense to start there and expand to other message bus implementations.

Ideally, the client libraries themselves would support adding hooks allowing the OpenCensus tag/trace propagation mechanics to kick in, but that's more invasive than providing users some convenience functions for marshalling/un-marshalling messages that may contain OpenCensus tag/trace information.

For my current needs, implementations at least in Python and Go would be hugely beneficial.

mtwo commented 5 years ago

@c24t @dinooliva @SergeyKanzhelev @bogdandrutu FYI

For HTTP we have the W3C spec, but you're correct that in other formats things are less clear. For example, @SergeyKanzhelev is looking into formats for MQTT, AMQP on behalf of the W3C group.

@dinooliva, can you add the details of the PubSub context propagation format into the specs repo somewhere?