diff --git a/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs b/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs index b7797eeb97..2f49fbff06 100644 --- a/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs +++ b/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs @@ -71,11 +71,6 @@ protected override void OnEventSourceCreated(EventSource eventSource) } } } - - private void EnableEvents(EventSource eventSource) - { - this.EnableEvents(eventSource, EventLevel.Critical, EventKeywords.None, GetEnableEventsArguments(this.options)); - } /// protected override void OnEventWritten(EventWrittenEventArgs eventData) @@ -122,6 +117,11 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData) this.UpdateInstrumentWithEvent(hasMean, eventSourceName, name, value); } + private void EnableEvents(EventSource eventSource) + { + this.EnableEvents(eventSource, EventLevel.Critical, EventKeywords.None, GetEnableEventsArguments(this.options)); + } + private static Dictionary GetEnableEventsArguments(EventCountersInstrumentationOptions options) => new() { { "EventCounterIntervalSec", options.RefreshIntervalSecs.ToString() } };