Skip to content

EventSource startup initialization#106014

Merged
noahfalk merged 2 commits intodotnet:mainfrom
noahfalk:runtime_metrics_init
Aug 8, 2024
Merged

EventSource startup initialization#106014
noahfalk merged 2 commits intodotnet:mainfrom
noahfalk:runtime_metrics_init

Conversation

@noahfalk
Copy link
Member

@noahfalk noahfalk commented Aug 6, 2024

Fixes #105845

Previously MetricsEventSource wasn't being created for apps that didn't ever create a Meter. This caused a chicken-and-egg problem for RuntimeMetrics which weren't created until MetricsEventSource started a tracing session. This change ensures that MetricsEventSource will be created on demand if ETW, EventPipe, or EventListener based tooling starts a tracing session. I took some extra effort to create the EventSource in a deferred fashion to avoid eager loading System.Diagnostics.DiagnosticSource.dll when it might never be needed.

Aside from the fix there were some small improvements:

  • Moved NativeRuntimeEventSource to initialize in the same place as other startup EventSources
  • Removed a useless lock(EventListener.EventListenersLock) around EventPipe eventProvider registration

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initializing RuntimeMetrics

6 participants