Пример #1
0
            /// <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);
            }
Пример #2
0
 /// <summary>
 /// Include metrics around volume of locks contended.
 /// </summary>
 public Builder WithContentionStats()
 {
     StatsCollectors.Add(new ContentionStatsCollector());
     return(this);
 }
Пример #3
0
 /// <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);
 }
Пример #4
0
 public Builder WithCustomCollector(IEventSourceStatsCollector statsCollector)
 {
     StatsCollectors.Add(statsCollector);
     return(this);
 }
Пример #5
0
 /// <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);
 }