Interface INeosActivity
Provides an interface for managing and interacting with an activity, including setting tags, managing trace information, and configuring parent relationships.
public interface INeosActivity : IDisposable
- Inherited Members
Properties
DisplayName
Gets or sets the display name of the activity.
string DisplayName { get; set; }
Property Value
Id
Gets the unique identifier of the activity.
string? Id { get; }
Property Value
Tags
Gets the tags of this activity.
IDictionary<string, object?> Tags { get; }
Property Value
TraceState
Gets or sets the trace state string for the activity.
string? TraceState { get; set; }
Property Value
Methods
SetParentId(string)
Sets the parent ID for the activity.
void SetParentId(string traceParent)
Parameters
traceParentstringThe parent trace identifier.
SetStatus(ActivityStatusCode, string?)
Sets the status of the activity.
void SetStatus(ActivityStatusCode status, string? description = null)
Parameters
statusActivityStatusCodeThe status.
descriptionstringAn optional description of the status.
SetTag(string, int?)
Sets a tag on the activity with an integer value.
bool SetTag(string key, int? value)
Parameters
Returns
- bool
True if the tag was set; otherwise, false.
SetTag(string, object?)
Sets a tag on the activity with a serialized object value.
bool SetTag(string key, object? value)
Parameters
Returns
- bool
True if the tag was set; otherwise, false.
SetTag(string, string?)
Sets a tag on the activity with a string value.
bool SetTag(string key, string? value)
Parameters
Returns
- bool
True if the tag was set; otherwise, false.
SetTags(IConfiguration)
Sets standard service tags on the activity from configuration.
bool SetTags(IConfiguration configuration)
Parameters
configurationIConfigurationThe configuration to read service tags from.
Returns
- bool
True if tags were set; otherwise, false.
SetTags(IDictionary<string, object?>)
Sets multiple tags on the activity from a dictionary of object values.
bool SetTags(IDictionary<string, object?> tags)
Parameters
tagsIDictionary<string, object>The tags to set.
Returns
- bool
True if tags were set; otherwise, false.
SetTags(IDictionary<string, string>)
Sets multiple tags on the activity from a dictionary of string values.
bool SetTags(IDictionary<string, string> tags)
Parameters
tagsIDictionary<string, string>The tags to set.
Returns
- bool
True if tags were set; otherwise, false.
Stop()
Stops the activity, marking it as completed.
void Stop()
SuppressRecord()
Suppresses the record of the activity, preventing it from being recorded in the trace.
void SuppressRecord()
WithTag(string, object?)
Adds or updates a tag with the specified key and value for the activity, returning the activity instance with the tag applied.
INeosActivity WithTag(string key, object? value)
Parameters
keystringThe key that identifies the tag to add or update. Cannot be null or empty.
valueobjectThe value to associate with the specified tag key. May be null to indicate the absence of a value.
Returns
- INeosActivity
The activity instance with the specified tag added or updated.
Remarks
Tags can be used to attach additional metadata to the activity for tracing or diagnostic purposes.