private EventCounterAdapter(EventCounterAdapterOptions options) { _options = options; _metricFactory = Metrics.WithCustomRegistry(_options.Registry); _gauge = _metricFactory.CreateGauge("dotnet_gauge", "Values from .NET aggregating EventCounters (count per second).", new GaugeConfiguration { LabelNames = new[] { "source", "name", "display_name" } }); _counter = _metricFactory.CreateCounter("dotnet_counter", "Values from .NET incrementing EventCounters.", new CounterConfiguration { LabelNames = new[] { "source", "name", "display_name" } }); _listener = new Listener(OnEventSourceCreated, OnEventWritten); }
public static IDisposable StartListening(EventCounterAdapterOptions options) => new EventCounterAdapter(options);