Class ActivitySourceExtensions
- Namespace
- Temporalio.Extensions.OpenTelemetry
- Assembly
- Temporalio.Extensions.OpenTelemetry.dll
Temporal extensions to ActivitySource.
public static class ActivitySourceExtensions
- Inheritance
-
ActivitySourceExtensions
- Inherited Members
Methods
TrackWorkflowDiagnosticActivity(ActivitySource, string, ActivityKind, IEnumerable<KeyValuePair<string, object?>>?, IEnumerable<ActivityLink>?, bool, bool, Action<Activity>?)
Create a WorkflowDiagnosticActivity and set it as current. Can only be called within a workflow. WARNING: This method should not be considered stable and may change.
public static WorkflowDiagnosticActivity TrackWorkflowDiagnosticActivity(this ActivitySource source, string name, ActivityKind kind = ActivityKind.Internal, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, bool evenOnReplay = false, bool inheritParentTags = true, Action<Activity>? updateActivity = null)
Parameters
source
ActivitySourceThe source to start an internal activity on if needed.
name
stringOperation name.
kind
ActivityKindActivity kind.
tags
IEnumerable<KeyValuePair<string, object>>Tags for the workflow activity. See
inheritParentTags
.links
IEnumerable<ActivityLink>Activity links.
evenOnReplay
boolIf false (the default), the internal activity on the source will only be started when the workflow isn't replaying. If true, the internal activity will always be started.
inheritParentTags
boolIf true (the default), any tags on the parent WorkflowDiagnosticActivity will be prepended to any given tags and used. If false, only given tags are used. This differs from standard
ActivitySource.StartActivity
behavior by intention so workflow tags can be propagated.updateActivity
Action<Activity>If present and an internal activity is started from the source, this is invoked with the started activity before it is immediately stopped.
Returns
- WorkflowDiagnosticActivity
The started workflow activity set as current.
Remarks
This starts and immediately stops an Activity since workflows do not
support long-running .NET activities because workflows are interruptible/resumable. This
method should be used instead of any other call on ActivitySource inside
of workflows as it is replay safe. This will always return a value even if there is no
.NET activity created (e.g. no listener, during replay, etc). Users must call
Dispose
on the activity to remove it from the current context.