Skip to content

Add telemetry support for diagnostics#57

Merged
koenbeuk merged 2 commits intomainfrom
feat/telemetry
May 5, 2026
Merged

Add telemetry support for diagnostics#57
koenbeuk merged 2 commits intomainfrom
feat/telemetry

Conversation

@koenbeuk
Copy link
Copy Markdown
Collaborator

@koenbeuk koenbeuk commented May 4, 2026

Introduce telemetry capabilities using ActivitySource, Meter, and EventSource to 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.

Copilot AI review requested due to automatic review settings May 4, 2026 22:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and EventSource definitions under ExpressiveSharp.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 thread src/ExpressiveSharp/Services/ExpressiveResolver.cs Outdated
Comment thread src/ExpressiveSharp/Diagnostics/ExpressiveEventSource.cs Outdated
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;
});
Comment thread docs/reference/troubleshooting.md Outdated
Comment thread docs/reference/telemetry.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

@koenbeuk koenbeuk merged commit e9860ad into main May 5, 2026
17 checks passed
@koenbeuk koenbeuk deleted the feat/telemetry branch May 5, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants