DiagnosticEventCollector
class
Namespace: Orleans.TestingHost.Diagnostics
A test utility for collecting and waiting on diagnostic events. Subscribes to
System.Diagnostics.DiagnosticListener.AllListeners and captures events from listeners matching specified patterns. public sealed class DiagnosticEventCollector : IDisposable, IObserver<KeyValuePair<string, object?>>, IObserver<DiagnosticListener>Remarks
Use this class to wait for specific Orleans events in tests without relying on Task.Delay or Thread.Sleep.
Constructors
DiagnosticEventCollector(IEnumerable<string>)Creates a new diagnostic event collector that subscribes to listeners with names starting with any of the specified prefixes.DiagnosticEventCollector(string[])Creates a new diagnostic event collector that subscribes to listeners with names starting with any of the specified prefixes.
Properties
EventsGets all captured diagnostic events.
Methods
ClearClears all captured events.CreateEventAwaiter(string)Creates a task that completes when the specified event is captured. Unlike WaitForEventAsync, this does not check for existing events.DisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.GetEventCount(string)Gets the count of events with the specified name.GetEvents(string)Gets events with the specified name.WaitForEventAsync(string, Func<DiagnosticEvent, bool>, TimeSpan, CancellationToken)Waits for an event with the specified name that matches a predicate.WaitForEventAsync(string, TimeSpan, CancellationToken)Waits for an event with the specified name to be captured. If an event with that name has already been captured, returns immediately.WaitForEventCountAsync(string, int, TimeSpan, CancellationToken)Waits until at least the specified number of events with the given name have been captured.
