temporalio / sdk-core

Core Temporal SDK that can be used as a base for language specific Temporal SDKs
MIT License
271 stars 72 forks source link

sdk: create spans for RunWorkflow and RunActivity #760

Closed valkum closed 3 months ago

valkum commented 3 months ago

What was changed

This PR expands OpenTelemetry support in the Rust SDK. The workflow and activity futures get instrumented using tracing (similar to other places in the code). To follow other SDKs such as the python one, the spans use "otel.name" (special keyword from tracing-opentelemtry to create a span name with the type name of the workflow/activity.

Why?

Currently, these futures get spawned and thus don't have a root span. To get a root span boilerplate code is required in all workflow and activity functions. To have less boilerplate and to follow the naming conventions more strictly first party support is desired. I plan on expanding this with support for propagation.

Discussion

This currently relies on internals of the tracing-opentelemetry crate (otel.name and otel.kind resource names). Also, this is currently not configurable. Other crates in the workspace already use the tracing crate and/or the OpenTelemetry crates. I think this is a far better state than relying on copied boilerplate especially when adding propagation support.

Checklist

  1. Closes n/a

  2. How was this tested: This was tested using a local Jaeger instance. The generated span based on one of our workflows looks like this in Jaeger UI. image

  3. Any docs updates needed?

    Unsure if needed due to the non-official nature of the Rust SDK.
CLAassistant commented 3 months ago

CLA assistant check
All committers have signed the CLA.

CLAassistant commented 3 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.