Introduce new EventSource for DynamicProxy performance events and metrics
#717
+141
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
System.Diagnostics.Tracing.EventSourceused to be tightly bound to Event Tracing for Windows (ETW), but has since been turned into a cross-platform feature baked into the Framework Class Library (since .NET 5, anyway). CLI tools such asdotnet countersanddotnet tracehave been made available to monitor and collect events and metrics emitted fromEventSources.What this PR does is to add an
EventSource(named"Castle.DynamicProxy") to the library that allows cross-platform and dependency-free insights into DynamicProxy operations.Currently, this is unfinished work. There are no tests yet, and more event types may be added.
I'm also using this to explore (in the context of #408) whether
EventSourcecould possibly replace DynamicProxy's use of CastleILoggers. WhileEventSourceand its surrounding tools seem more concerned with performance analysis than with conventional logging, this may still be a good match. After all, DynamicProxy is already logging mostly about things that have performance implications.