ScopedActivityListenerOptions Class

public sealed class ScopedActivityListenerOptions

Constructors

NameDescription
ScopedActivityListenerOptions()

ScopedActivityListenerOptions()

ScopedActivityListenerOptions.cs
public ScopedActivityListenerOptions()

No documentation is available.

Properties

NameDescription
CaptureChildActivitiesGets or sets a value indicating whether the activities whose parent is captured are also captured, even when the asynchronous scope was lost. The default value is true.
MaxActivityCountGets or sets the maximum number of completed activities kept in ScopedActivityListener.Activities. When the limit is reached, the oldest activities are dropped. The default value is Int32.MaxValue.
SamplingResultGets or sets the sampling result returned for the activities created in the scope. The default value is ActivitySamplingResult.AllData.
ShouldListenToGets or sets the predicate used for ActivityListener.ShouldListenTo. The default value listens to every source.
SourceNamesGets or sets the names of the ActivitySource to listen to, compared with StringComparison.Ordinal. This value is ignored when ScopedActivityListenerOptions.ShouldListenTo is set. Use String.Empty to listen to the activities created with new Activity(name).

CaptureChildActivities

ScopedActivityListenerOptions.cs

Gets or sets a value indicating whether the activities whose parent is captured are also captured, even when the asynchronous scope was lost. The default value is true.

public bool CaptureChildActivities { get; set; }

Property value

bool

Gets or sets the maximum number of completed activities kept in ScopedActivityListener.Activities. When the limit is reached, the oldest activities are dropped. The default value is Int32.MaxValue.

public int MaxActivityCount { get; set; }

Property value

int

Gets or sets the sampling result returned for the activities created in the scope. The default value is ActivitySamplingResult.AllData.

public ActivitySamplingResult SamplingResult { get; set; }

Property value

ActivitySamplingResult

Remarks

ActivitySamplingResult.AllDataAndRecorded sets ActivityTraceFlags.Recorded, which is propagated to the downstream services through the traceparent header and changes their own sampling decisions.

Gets or sets the predicate used for ActivityListener.ShouldListenTo. The default value listens to every source.

public Func<ActivitySource, bool>? ShouldListenTo { get; set; }

Property value

Func<ActivitySource, bool>?

Remarks

The predicate is evaluated once per ActivitySource and its result is cached by the runtime, so it must be a pure function of the source. In particular it cannot depend on the current asynchronous flow.

Gets or sets the names of the ActivitySource to listen to, compared with StringComparison.Ordinal. This value is ignored when ScopedActivityListenerOptions.ShouldListenTo is set. Use String.Empty to listen to the activities created with new Activity(name).

public IReadOnlyList<string>? SourceNames { get; set; }