coinbase / temporal-ruby

Ruby SDK for Temporal
Apache License 2.0
223 stars 84 forks source link

OpenTracing / Context propagation support #175

Open chuckremes2 opened 2 years ago

chuckremes2 commented 2 years ago

As suggested by @jeffschoner-stripe and @drewhoskins-stripe, I am creating a github issue to discuss the topic of context propagation for the Ruby SDK.

Tracing Proposal

Why

Distributed applications are more difficult to measure and debug due to the distributed nature of their processing. One cannot simply attach to the running process with a debugger and capture state since that state may be spread across multiple processes or systems. Temporal, by its nature, is distributed. Any application written using Temporal will also be distributed. In order to trace through the behavior of the business logic implemented as workflow(s) and activit(ies) we should provide support for OpenTracing and other related tracing mechanisms.

The Java, Go, and Typescript SDKs all support OpenTracing today via context propagation. The Ruby SDK can support Tracing today without any changes merely by allowing the programmer to pass the Tracing context as an argument to every workflow and activity. This is sloppy and error prone, so we should mimic the facilities exposed by the aforementioned SDKs and allow the context to propagate automatically using the Temporal headers.

What

This defines the interface for passing in OpenTracing contexts to the Temporal system. Upon configuration, the propagation of this information should be automatic and transparent to the programmer. Aside from initial configuration, methods should be exposed on the workflow and activity that allow for adding to the existing (if any) context.

Workflow Configuration

Will fill this out in next edit... thinking about it.

antstorm commented 2 years ago

I really like this project because it should point to where we potentially lack feature extendability. Not to mention that tracing is very important and useful. It will make many devs debugging their workflows super happy 😃

tim37021 commented 2 years ago

Related issue: https://community.temporal.io/t/opentracing-integration/3771

I am curious about how other SDK integrate OpenTracing. I think the spans is usually uploaded after it's finished. Even though the context can be propagated, the root span will take a very long time to finish. So that we are not possible to group those activity span together?