編輯

共用方式為


DiagnosticSource.StartActivity Method

Definition

Overloads

StartActivity(Activity, Object)

Starts an Activity and writes a start event.

StartActivity<T>(Activity, T)

StartActivity(Activity, Object)

Source:
DiagnosticSourceActivity.cs
Source:
DiagnosticSourceActivity.cs
Source:
DiagnosticSourceActivity.cs

Starts an Activity and writes a start event.

public:
 System::Diagnostics::Activity ^ StartActivity(System::Diagnostics::Activity ^ activity, System::Object ^ args);
public System.Diagnostics.Activity StartActivity (System.Diagnostics.Activity activity, object? args);
public System.Diagnostics.Activity StartActivity (System.Diagnostics.Activity activity, object args);
member this.StartActivity : System.Diagnostics.Activity * obj -> System.Diagnostics.Activity
Public Function StartActivity (activity As Activity, args As Object) As Activity

Parameters

activity
Activity

The Activity to be started.

args
Object

An object that represent the value being passed as a payload for the event.

Returns

The started activity for convenient chaining.

Remarks

The Activity describes the logical operation, its context, and parent relation; the current Activity flows through the operation processing.

This method starts the given Activity, maintains a global Activity.Current and Activity.Parent activity for the given Activity, and notifies consumers that a new Activity was started. Consumers can access Activity.Current to add context and/or augment telemetry.

Producers may pass additional details to the consumer in the payload.

Applies to

StartActivity<T>(Activity, T)

Source:
DiagnosticSourceActivity.cs
Source:
DiagnosticSourceActivity.cs
public:
generic <typename T>
 System::Diagnostics::Activity ^ StartActivity(System::Diagnostics::Activity ^ activity, T args);
public System.Diagnostics.Activity StartActivity<T> (System.Diagnostics.Activity activity, T args);
member this.StartActivity : System.Diagnostics.Activity * 'T -> System.Diagnostics.Activity
Public Function StartActivity(Of T) (activity As Activity, args As T) As Activity

Type Parameters

T

Parameters

activity
Activity
args
T

Returns

Applies to