Share via


ActivityExtensions.StartClientActivity Method

Definition

Creates and starts a new Activity if there are active listeners and if distributed tracing is enabled. Creates the Activity using the specified name, kind, parent activity context, and tags.

public static System.Diagnostics.Activity? StartClientActivity(this System.Diagnostics.ActivitySource activitySource, System.ClientModel.Primitives.ClientPipelineOptions options, string name, System.Diagnostics.ActivityKind kind = System.Diagnostics.ActivityKind.Internal, System.Diagnostics.ActivityContext parentContext = default, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags = default);
static member StartClientActivity : System.Diagnostics.ActivitySource * System.ClientModel.Primitives.ClientPipelineOptions * string * System.Diagnostics.ActivityKind * System.Diagnostics.ActivityContext * seq<System.Collections.Generic.KeyValuePair<string, obj>> -> System.Diagnostics.Activity
<Extension()>
Public Function StartClientActivity (activitySource As ActivitySource, options As ClientPipelineOptions, name As String, Optional kind As ActivityKind = System.Diagnostics.ActivityKind.Internal, Optional parentContext As ActivityContext = Nothing, Optional tags As IEnumerable(Of KeyValuePair(Of String, Object)) = Nothing) As Activity

Parameters

activitySource
ActivitySource

The ActivitySource to use to create the Activity.

options
ClientPipelineOptions

The options used to configure the client pipeline.

name
String

The operation name of the activity.

kind
ActivityKind

The activity kind.

parentContext
ActivityContext

The parent ActivityContext object to initialize the created Activity object with.

tags
IEnumerable<KeyValuePair<String,Object>>

The optional tags list to initialize the created Activity object with.

Returns

Remarks

This extension method is intended to be used by client library authors only. Applications should use one of the overloads of StartActivity(String, ActivityKind) to create and start Activity instances.

Applies to