/// <summary> /// Finishes configuration and starts collecting .NET runtime metrics. Returns a <see cref="IDisposable"/> that /// can be disposed of to stop metric collection. /// </summary> /// <returns></returns> public IDisposable StartCollecting() { if (DotNetRuntimeStatsCollector.Instance != null) { throw new InvalidOperationException(".NET runtime metrics are already being collected. Dispose() of your previous collector before calling this method again."); } var runtimeStatsCollector = new DotNetRuntimeStatsCollector(StatsCollectors.ToImmutableHashSet(), _errorHandler); runtimeStatsCollector.RegisterMetrics(Telemetry); return(runtimeStatsCollector); }
/// <summary> /// Include metrics around volume of locks contended. /// </summary> public Builder WithContentionStats() { StatsCollectors.Add(new ContentionStatsCollector()); return(this); }
/// <summary> /// Include metrics around the size of the worker and IO thread pools and reasons /// for worker thread pool changes. /// </summary> public Builder WithThreadPoolStats() { StatsCollectors.Add(new ThreadPoolStatsCollector()); return(this); }
public Builder WithCustomCollector(IEventSourceStatsCollector statsCollector) { StatsCollectors.Add(statsCollector); return(this); }
/// <summary> /// Include metrics recording the frequency and duration of garbage collections/ pauses, heap sizes and /// volume of allocations. /// </summary> public Builder WithGcStats() { StatsCollectors.Add(new GcStatsCollector()); return(this); }