ActivitySource Class

Definition

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

public ref class ActivitySource sealed : IDisposable
public sealed class ActivitySource : IDisposable
type ActivitySource = class
    interface IDisposable
Public NotInheritable Class ActivitySource
Implements IDisposable
Inheritance
ActivitySource
Implements

Constructors

ActivitySource(String, String)

Constructs an activity source object with the specified name.

Properties

Name

Returns the activity source name.

Version

Returns the activity source version.

Methods

AddActivityListener(ActivityListener)

Adds a listener to the activity starting and stopping events.

CreateActivity(String, ActivityKind)

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

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.

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)

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

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

Creates 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 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.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to