Table of Contents

Class WorkflowDiagnosticActivity

Namespace
Temporalio.Extensions.OpenTelemetry
Assembly
Temporalio.Extensions.OpenTelemetry.dll

Representation of a workflow-safe diagnostic activity.

public class WorkflowDiagnosticActivity : IDisposable
Inheritance
WorkflowDiagnosticActivity
Implements
Inherited Members

Remarks

This wraps an Activity, but the inner activity may not be present because either this activity was created while replaying or the inner activity was not created by the ActivitySource because there are no listeners. Callers must call Dispose() to remove the created workflow activity from current.

Properties

Activity

Gets the inner diagnostic activity for this workflow activity. This may be null if the activity was not created (e.g. during replay or activity source returned null). This activity has already been started and stopped.

public Activity? Activity { get; }

Property Value

Activity

Context

Gets the diagnostic activity context for this workflow activity.

public ActivityContext Context { get; }

Property Value

ActivityContext

Current

Gets the current workflow activity. This is never null TracingInterceptor is configured (and something illegal didn't happen like leaving the async-local context).

public static WorkflowDiagnosticActivity? Current { get; }

Property Value

WorkflowDiagnosticActivity

Parent

Gets the parent of this activity, i.e. the Current when this activity was created.

public WorkflowDiagnosticActivity? Parent { get; }

Property Value

WorkflowDiagnosticActivity

Tags

Gets the set of tags for this activity. This is separate from Activity tags because not only might these exist when the activity doesn't, but creating an activity needs them for default tag inheritance.

public IReadOnlyCollection<KeyValuePair<string, object?>>? Tags { get; }

Property Value

IReadOnlyCollection<KeyValuePair<string, object>>

Methods

AttachFromContext(ActivityContext, IReadOnlyCollection<KeyValuePair<string, object?>>?)

Create and set a workflow activity as current for the given context.

public static WorkflowDiagnosticActivity AttachFromContext(ActivityContext context, IReadOnlyCollection<KeyValuePair<string, object?>>? tags = null)

Parameters

context ActivityContext

Context for the current activity.

tags IReadOnlyCollection<KeyValuePair<string, object>>

Optional tags to set for the context.

Returns

WorkflowDiagnosticActivity

Created workflow activity.

Dispose()

public void Dispose()

Dispose(bool)

Dispose.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Whether disposing.