TemporalSdk.Activity (temporal_sdk v0.2.20)
View SourceTemporal activity task module.
OpenTelemetry
Activity execution inherits its OpenTelemetry trace from the parent workflow. Traces propagate across
Temporal tasks via task headers, using the W3C Trace Context standard through :otel_propagator_text_map.
Once activity execution starts, a new OpenTelemetry "RunActivity" span is created using the parent
workflow's context. OpenTelemetry context is attached to the activity execution process, enabling
standard OpenTelemetry commands, such as adding user-defined spans, attributes, events, etc.
"RunActivity" span is created after activity task is polled and execution processing starts using
worker node local time.
"RunActivity" span includes an OpenTelemetry event "StartActivityTask" created at the activity task
(server) :started_time.
SDK Samples Otel Sample demonstrates how to extract baggage from the inherited trace context, add span attributes, and start a new span.
Summary
Functions
@spec await_data(ets_pattern :: term()) :: {:ok, :temporal_sdk_activity.data()} | :timeout | :invalid_pattern | no_return()
@spec await_data(ets_pattern :: term(), timeout :: :erlang.timeout()) :: {:ok, :temporal_sdk_activity.data()} | :timeout | :invalid_pattern | no_return()
@spec cancel(canceled_details :: :temporal_sdk.term_to_payloads()) :: no_return()
@spec complete(result :: :temporal_sdk.term_to_payloads()) :: no_return()
@spec elapsed_time() :: native_time :: non_neg_integer() | no_return()
@spec elapsed_time(unit :: :erlang.time_unit()) :: non_neg_integer() | no_return()
@spec fail( application_failure :: :temporal_sdk.application_failure() | :temporal_sdk.application_failure_as_list() ) :: no_return()
@spec fail( class :: :error | :exit | :throw | :temporal_sdk.serializable(), reason :: term() | :temporal_sdk.serializable(), stacktrace :: :erlang.raise_stacktrace() | :temporal_sdk.serializable() ) :: no_return()
@spec get_data() :: data :: :temporal_sdk_activity.data() | no_return()
@spec heartbeat() :: :ok
@spec heartbeat(heartbeat :: :temporal_sdk_activity.heartbeat()) :: :ok
@spec last_heartbeat() :: last_heartbeat :: :temporal_sdk_activity.heartbeat() | no_return()
@spec remaining_time() :: native_time :: non_neg_integer() | :infinity | no_return()
@spec remaining_time(unit :: :erlang.time_unit()) :: non_neg_integer() | :infinity | no_return()
@spec set_data(task_data :: term()) :: :ok