ScopedActivityListenerOptions Class
Options for ScopedActivityListener.
public sealed class ScopedActivityListenerOptionsConstructors
| Name | Description |
|---|---|
| ScopedActivityListenerOptions() |
ScopedActivityListenerOptions()
ScopedActivityListenerOptions.cspublic ScopedActivityListenerOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| CaptureChildActivities | 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. |
| MaxActivityCount | 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. |
| SamplingResult | Gets or sets the sampling result returned for the activities created in the scope. The default value is ActivitySamplingResult.AllData. |
| ShouldListenTo | Gets or sets the predicate used for ActivityListener.ShouldListenTo. The default value listens to every source. |
| SourceNames | 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). |
CaptureChildActivities
ScopedActivityListenerOptions.csMaxActivityCount
ScopedActivityListenerOptions.csGets 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
SamplingResult
ScopedActivityListenerOptions.csGets 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
Remarks
ActivitySamplingResult.AllDataAndRecorded sets ActivityTraceFlags.Recorded, which is propagated to the downstream services through the traceparent header and changes their own sampling decisions.
ShouldListenTo
ScopedActivityListenerOptions.csGets or sets the predicate used for ActivityListener.ShouldListenTo. The default value listens to every source.
public Func<ActivitySource, bool>? ShouldListenTo { get; set; }Property value
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.
SourceNames
ScopedActivityListenerOptions.csGets 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; }