<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0-rc1.19456.4" />

Activity

public class Activity
Represents an operation with context to be used for logging.
public static Activity Current { get; set; }

Gets or sets the current operation ( Activity) for the current thread. This flows across async calls.

public static ActivityIdFormat DefaultIdFormat { get; set; }

Gets or sets the default ID format for the Activity.

public static bool ForceDefaultIdFormat { get; set; }

Gets or sets a valud that detrmines if the DefaultIdFormat is always used to define the default ID format.

Gets the flags (defined by the W3C ID specification) associated with the activity.

public IEnumerable<KeyValuePair<string, string>> Baggage { get; }

Gets a collection of key/value pairs that represents information that is passed to children of this Activity.

public TimeSpan Duration { get; }

Gets the duration of the operation.

public string Id { get; }

Gets an identifier that is specific to a particular request.

public ActivityIdFormat IdFormat { get; }

Gets the format for the Id.

public string OperationName { get; }

Gets the operation name.

public Activity Parent { get; }

Gets the parent Activity that created this activity.

public string ParentId { get; }

Gets the ID of this activity's parent.

public ActivitySpanId ParentSpanId { get; }

Gets the parent's SpanId.

public bool Recorded { get; }

Gets a value that indicates whether the W3CIdFlags.Recorded flag is set.

public string RootId { get; }

Gets the root ID of this Activity.

public ActivitySpanId SpanId { get; }

Gets the SPAN part of the Id.

public DateTime StartTimeUtc { get; }

Gets the time when the operation started.

public IEnumerable<KeyValuePair<string, string>> Tags { get; }

Gets a collection of key/value pairs that represent information that will be logged along with the Activity to the logging system.

public ActivityTraceId TraceId { get; }

Gets the TraceId part of the Id.

public string TraceStateString { get; set; }

Gets the W3C tracestate header.

public Activity(string operationName)

Initializes a new instance of the Activity class.

public Activity AddBaggage(string key, string value)

Updates the Activity to have a new baggage item with the specified key and value.

public Activity AddTag(string key, string value)

Updates the Activity to have a new tag with the provided key and value. .

public string GetBaggageItem(string key)

Returns the value of a key-value pair added to the activity with AddBaggage.

public Activity SetEndTime(DateTime endTimeUtc)

Updates the Activity to set its Duration as the difference between StartTimeUtc and the specified stop time.

Sets the ID format on this Activity before it is started.

public Activity SetParentId(string parentId)

Updates this Activity to indicate that the Activity with an ID of parentId caused this Activity.

public Activity SetParentId(ActivityTraceId traceId, ActivitySpanId spanId, ActivityTraceFlags activityTraceFlags = 0)

Sets the parent ID using the W3C convention of a TraceId and a SpanId.

public Activity SetStartTime(DateTime startTimeUtc)

Sets the start time of this Activity.

public Activity Start()

Starts the activity.

public void Stop()

Stops the activity.