internal DotNetEventListener(IEventSourceStatsCollector collector, Action <Exception> errorHandler, bool enableDebugging, IMetrics metrics) : base()
        {
            _collector       = collector;
            _errorHandler    = errorHandler;
            _enableDebugging = enableDebugging;
            _metrics         = metrics;

            if (_enableDebugging)
            {
                _cpuConsumed = new TimerOptions()
                {
                    Context         = DotNetRuntimeMetricsRegistry.ContextName,
                    MeasurementUnit = Unit.None,
                    DurationUnit    = TimeUnit.Nanoseconds,
                    Name            = "dotnet_debug_cpu_nanoseconds_total",
                    Tags            = new MetricTags("collector", collector.GetType().Name.ToSnakeCase())
                };
            }

            _eventTypeCounts = new CounterOptions()
            {
                Context               = DotNetRuntimeMetricsRegistry.ContextName,
                MeasurementUnit       = Unit.Items,
                ReportItemPercentages = false
            };
            EventSourceCreated += OnEventSourceCreated;
        }
示例#2
0
 private void EnableEventSources(IEventSourceStatsCollector forCollector)
 {
     EventSourceCreated += (sender, e) =>
     {
         var es = e.EventSource;
         if (es.Guid == forCollector.EventSourceGuid)
         {
             EnableEvents(es, forCollector.Level, forCollector.Keywords);
         }
     };
 }
示例#3
0
        internal DotNetEventListener(IEventSourceStatsCollector collector, Action <Exception> errorHandler, bool enableDebugging) : base()
        {
            _collector       = collector;
            _errorHandler    = errorHandler;
            _enableDebugging = enableDebugging;

            if (_enableDebugging)
            {
                _eventTypeCounts ??= Metrics.CreateCounter($"dotnet_debug_events_total", "The total number of .NET diagnostic events processed", "collector_name", "event_source_name", "event_name");
                _cpuConsumed ??= Metrics.CreateCounter("dotnet_debug_cpu_seconds_total", "The total CPU time consumed by processing .NET diagnostic events (does not include the CPU cost to generate the events)", "collector_name", "event_source_name", "event_name");
                _nameSnakeCase = collector.GetType().Name.ToSnakeCase();
            }
            EventSourceCreated += OnEventSourceCreated;
        }
示例#4
0
 public Builder WithCustomCollector(IEventSourceStatsCollector statsCollector)
 {
     StatsCollectors.Add(statsCollector);
     return(this);
 }
示例#5
0
 internal DotNetEventListener(IEventSourceStatsCollector collector, Action <Exception> errorHandler) : base()
 {
     _collector    = collector;
     _errorHandler = errorHandler;
     EnableEventSources(collector);
 }