Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an operation with context to be used for logging.
public ref class Activity : IDisposable
public ref class Activity
public class Activity : IDisposable
public class Activity
type Activity = class interface IDisposable
type Activity = class
Public Class Activity Implements IDisposable
Public Class Activity
Activity has an operation name, an ID, a start time and duration, tags, and baggage.
The current activity can be accessed with the static Activity.Current property.
Activities should be created by calling the constructor, configured as necessary, and then started with the Start method, which maintains parent-child relationships for the activities and sets Activity.Current.
When an activity is finished, it should be stopped with the Activity.Stop() method.
Activity methods allow exceptions to escape as a response to bad inputs. They are thrown and caught (which allows debuggers and monitors to see the error), but the exception is suppressed, and the operation does something reasonable (typically it does nothing).
Initializes a new instance of the Activity class.
Gets or sets the flags (defined by the W3C ID specification) associated with the activity.
Gets a collection of key/value pairs that represents information that is passed to children of this Activity.
Gets the context of the activity. Context becomes valid only if the activity has been started.
Gets or sets the current operation (Activity) for the current thread. This flows across async calls.
Gets or sets the default ID format for the Activity.
Gets or sets the display name of the activity.
Gets the duration of the operation.
Gets the list of all the activity events attached to this activity.
Gets or sets a value that detrmines if the DefaultIdFormat is always used to define the default ID format.
Gets a value that indicates whether the parent context was created from remote propagation.
Gets an identifier that is specific to a particular request.
Gets the format for the Id.
Gets or sets a value that indicates whether this activity should be populated with all the propagation information, as well as all the other properties, such as links, tags, and events.
Gets a value that indicates whether this Activity object is stopped or not.
Gets the relationship between the activity, its parents, and its children in a trace.
Gets the list of all the activity links attached to this activity.
Gets the operation name.
Gets the parent Activity that created this activity.
Gets the ID of this activity's parent.
Gets the parent's SpanId.
Gets a value that indicates whether the W3CIdFlags.Recorded flag is set.
Gets the root ID of this Activity.
Gets the activity source associated with this activity.
Gets the SPAN part of the Id.
Gets the time when the operation started.
Gets status code of the current activity object.
Gets the status description of the current activity object.
Gets the list of tags that represent information to log along with the activity. This information is not passed on to the children of this activity.
Gets a collection of key/value pairs that represent information that will be logged along with the Activity to the logging system.
Gets the TraceId part of the Id.
When starting an Activity which does not have a parent context, the Trace Id will automatically be generated using random numbers. TraceIdGenerator can be used to override the runtime's default Trace Id generation algorithm.
Gets or sets the W3C
Updates the Activity to have a new baggage item with the specified key and value.
Adds the specified activity event to the events list.
Updates the activity to have a tag with an additional
Updates the Activity to have a new tag with the provided
Stops the activity if it is already started and notifies any event listeners. Nothing will happen otherwise.
When overriden by a derived type, this method releases any allocated resources.
Enumerates the ActivityEvent objects attached to this Activity object.
Enumerates the ActivityLink objects attached to this Activity object.
Enumerates the tags attached to this Activity object.
Determines whether the specified object is equal to the current object.(Inherited from Object)
Returns the value of a key-value pair added to the activity with AddBaggage(String, String).
Returns the object mapped to the specified property name.
Serves as the default hash function.(Inherited from Object)
Returns the value of the Activity tag mapped to the input key/>.
Gets the Type of the current instance.(Inherited from Object)
Creates a shallow copy of the current Object.(Inherited from Object)
Add or update the Activity baggage with the input key and value.
If the input value is
Attaches any custom object to this activity. If the specified
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.
|SetParentId(ActivityTraceId, ActivitySpanId, ActivityTraceFlags)||
Sets the parent ID using the W3C convention of a TraceId and a SpanId.
Updates this Activity to indicate that the Activity with an ID of
Sets the start time of this Activity.
Sets the status code and description on the current activity object.
Adds or update the activity tag with the input key and value.
Starts the activity.
Stops the activity.
Returns a string that represents the current object.(Inherited from Object)
Occurs when the Current value changes.