Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds runtime telemetry to ExpressiveSharp so callers can observe expression expansion, cache behavior, reflection fallback usage, and selected failure paths through standard .NET diagnostics.
Changes:
- Added a new diagnostics surface with
ActivitySource,Meter, andEventSourcedefinitions underExpressiveSharp.Diagnostics. - Instrumented expression expansion, resolver cache/reflection fallback paths, and hot-reload / registry error handling.
- Added telemetry-focused tests and documentation, including a new reference page and sidebar entry.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tests/ExpressiveSharp.Tests/Diagnostics/ExpressiveDiagnosticsTests.cs |
Adds unit tests for activities, metrics, and event emission helpers. |
src/ExpressiveSharp/Services/ExpressiveResolver.cs |
Records cache/fallback telemetry and emits events for registry failures and mapping collisions. |
src/ExpressiveSharp/Services/ExpressiveHotReloadHandler.cs |
Logs hot-reload registry reset failures through the new event source. |
src/ExpressiveSharp/Extensions/ExpressionExtensions.cs |
Wraps expression expansion with activity/metric collection. |
src/ExpressiveSharp/Diagnostics/ExpressiveEventSource.cs |
Introduces the EventSource and its runtime diagnostic events. |
src/ExpressiveSharp/Diagnostics/ExpressiveDiagnostics.cs |
Defines the shared telemetry source name plus counters and histograms. |
docs/reference/troubleshooting.md |
Adds troubleshooting guidance for runtime telemetry collection. |
docs/reference/telemetry.md |
Adds the telemetry reference page describing spans, metrics, events, and tooling. |
docs/.vitepress/config.mts |
Adds the telemetry page to the docs sidebar. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+259
to
+268
| var result = _reflectionCache.GetOrAdd(expressiveMemberInfo, static mi => | ||
| { | ||
| var built = BuildReflectionExpression(mi); | ||
| if (ExpressiveDiagnostics.ReflectionFallback.Enabled) | ||
| { | ||
| ExpressiveDiagnostics.ReflectionFallback.Add(1, | ||
| new KeyValuePair<string, object?>("member", mi.ToString())); | ||
| } | ||
| return built ?? _reflectionNullSentinel; | ||
| }); |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Introduce telemetry capabilities using
ActivitySource,Meter, andEventSourceto enhance diagnostics. This includes metrics for cache hits/misses and expansion timings, along with event logging for registry initialization failures and hot-reload issues. A new telemetry section is added to the documentation for user guidance.