ActivitySource
Provides APIs to create and start Activity objects and to register ActivityListener objects to listen to the Activity events.
Returns the activity source name.
Returns the activity source version.
Constructs an activity source object with the specified name.
public ActivitySource(string name, string version = "", IEnumerable<KeyValuePair<string, object>> tags = null)
Adds a listener to the activity starting and stopping events.
Creates a new Activity object if there is any listener to the Activity, returns null otherwise.
public Activity CreateActivity(string name, ActivityKind kind, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object>> tags = null, IEnumerable<ActivityLink> links = null, ActivityIdFormat idFormat = 0)
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.
public Activity CreateActivity(string name, ActivityKind kind, string parentId, IEnumerable<KeyValuePair<string, object>> tags = null, IEnumerable<ActivityLink> links = null, ActivityIdFormat idFormat = 0)
Creates a new Activity object if there is any listener to the Activity, returns null otherwise.
Disposes the activity source object, removes the current instance from the global list, and empties the listeners list.
Checks if there are any listeners for this activity source.
Creates a new activity if there are active listeners for it, using the specified name and activity kind.
public Activity StartActivity(string name, ActivityKind kind, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object>> tags = null, IEnumerable<ActivityLink> links = null, DateTimeOffset startTime = default)
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.
public Activity StartActivity(string name, ActivityKind kind, string parentId, IEnumerable<KeyValuePair<string, object>> tags = null, IEnumerable<ActivityLink> links = null, DateTimeOffset startTime = default)
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.
public Activity StartActivity(ActivityKind kind, ActivityContext parentContext = default, IEnumerable<KeyValuePair<string, object>> tags = null, IEnumerable<ActivityLink> links = null, DateTimeOffset startTime = default, string name = "")
Creates and starts a new Activity object if there is any listener to the Activity events, returns null otherwise.