private DiagnosticSourceAdapter(IMeasureCounterMetrics counter, DiagnosticSourceAdapterOptions options)
        {
            _options = options;
            _metric  = counter;

            var newListenerObserver = new NewListenerObserver(OnNewListener);

            _newListenerSubscription = DiagnosticListener.AllListeners.Subscribe(newListenerObserver);
        }
Exemple #2
0
        private DiagnosticSourceAdapter(DiagnosticSourceAdapterOptions options)
        {
            _options = options;
            _metric  = Metrics.WithCustomRegistry(options.Registry)
                       .CreateCounter("diagnostic_events_total", "Total count of events received via the DiagnosticSource infrastructure.", new CounterConfiguration
            {
                LabelNames = new[]
                {
                    "source",   // Name of the DiagnosticSource
                    "event"     // Name of the event
                }
            });

            var newListenerObserver = new NewListenerObserver(OnNewListener);

            _newListenerSubscription = DiagnosticListener.AllListeners.Subscribe(newListenerObserver);
        }