ActivitySource Class

Definition

Provides APIs to create and start Activity objects and to register ActivityListener objects to listen to the Activity events.

public sealed class ActivitySource : IDisposable
Inheritance
ActivitySource
Implements

Constructors

Properties

Name

Returns the activity source name.

Tags
Version

Returns the activity source version.

Methods

AddActivityListener(ActivityListener)

Adds a listener to the activity starting and stopping events.

CreateActivity(String, ActivityKind, ActivityContext, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, ActivityIdFormat)

Creates a new Activity object if there is any listener to the Activity, returns null otherwise. If the Activity object is created, it will not automatically start. Callers will need to call Start() to start it.

CreateActivity(String, ActivityKind, String, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, ActivityIdFormat)

Creates a new Activity object if there is any listener to the Activity, returns null otherwise.

CreateActivity(String, ActivityKind)

Creates a new Activity object if there is any listener to the Activity, returns null otherwise.

Dispose()

Disposes the activity source object, removes the current instance from the global list, and empties the listeners list.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
HasListeners()

Checks if there are any listeners for this activity source.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
StartActivity(ActivityKind, ActivityContext, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, DateTimeOffset, String)

Creates and starts a new Activity object if there is any listener to the Activity events, returns null otherwise.

StartActivity(String, ActivityKind, ActivityContext, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, DateTimeOffset)

Creates and starts a new activity if there are active listeners for it, using the specified name, activity kind, parent activity context, tags, optional activity link and optional start time.

StartActivity(String, ActivityKind, String, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, DateTimeOffset)

Creates and starts a new activity if there are active listeners for it, using the specified name, activity kind, parent Id, tags, optional activity links and optional start time.

StartActivity(String, ActivityKind)

Creates and starts a new activity if there are active listeners for it, using the specified name and activity kind.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

Prodotto Versioni
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)