Esempio n. 1
0
        public static IServiceCollection AddRuntimeStatCollectors(
            this IServiceCollection services,
            RuntimeStatCollectorsConfiguration runtimeStatCollectorsConfiguration = null)
        {
            services.AddSingleton <ContentionStatsCollector>();
            services.AddSingleton <ExceptionStatsCollector>();
            services.AddSingleton <GcStatsCollector>();
            services.AddSingleton <ThreadPoolSchedulingStatsCollector>();
            services.AddSingleton <ThreadPoolStatsCollector>();
            services.AddSingleton <ICollectorExceptionHandler, CollectorExceptionHandler>();
            services.AddSingleton(runtimeStatCollectorsConfiguration ??
                                  RuntimeStatCollectorsConfiguration.Default);

            return(services);
        }
 public ThreadPoolSchedulingStatsCollector(
     IMetricFactory metricFactory,
     IMemoryCache memoryCache,
     ICollectorExceptionHandler errorHandler,
     RuntimeStatCollectorsConfiguration configuration) : base(errorHandler)
 {
     _eventTimer = new EventTimer(
         memoryCache,
         EventIdThreadPoolEnqueueWork,
         EventIdThreadPoolDequeueWork,
         x => (long)x.Payload[0],
         "tpoolsched");
     ScheduledCount = metricFactory.CreateCounter("dotnet_threadpool_scheduled_total", "The total number of items the thread pool has been instructed to execute");
     ScheduleDelay  = metricFactory.CreateHistogram(
         "dotnet_threadpool_scheduling_delay_seconds",
         "A breakdown of the latency experienced between an item being scheduled for execution on the thread pool and it starting execution.",
         buckets: configuration.HistogramBuckets);
 }
Esempio n. 3
0
 public GcStatsCollector(
     IMetricFactory metricFactory,
     IMemoryCache memoryCache,
     ICollectorExceptionHandler errorHandler,
     RuntimeStatCollectorsConfiguration configuration) : base(errorHandler)
 {
     _memoryCache = memoryCache;
     _eventTimer  = new EventTimer(
         memoryCache,
         GCStart_V1,
         GCEnd_V1,
         x => Convert.ToInt64(x.Payload[0]), "gc");
     GcReasons = metricFactory.CreateCounter(
         "dotnet_gc_reason_total",
         "A tally of all the reasons that lead to garbage collections being run",
         false,
         "gc_gen",
         "gc_reason",
         "gc_type");
     GcDuration = metricFactory.CreateHistogram(
         "dotnet_gc_duration",
         "The amount of time spent running garbage collections",
         false,
         configuration.HistogramBuckets,
         "gc_gen",
         "gc_reason",
         "gc_type");
     GcHeapSizeInBytes = metricFactory.CreateGauge(
         "dotnet_gc_heap_size_bytes",
         "The current size of all heaps (only updated after a garbage collection)",
         false,
         "gc_gen");
     LargeObjectAllocationTypeTrigger = metricFactory.CreateCounter(
         "dotnet_gc_loh_type_trigger_total",
         "Objects that triggered Large Object Heap allocation",
         false,
         "type_name");
 }