Enable Application Insights instrumentation in csharp playground-server#10709
Open
JoshLove-msft wants to merge 1 commit into
Open
Enable Application Insights instrumentation in csharp playground-server#10709JoshLove-msft wants to merge 1 commit into
JoshLove-msft wants to merge 1 commit into
Conversation
Adds Microsoft.ApplicationInsights.AspNetCore (3.1.1) and registers the SDK in Program.cs. The connection string is read from the standard APPLICATIONINSIGHTS_CONNECTION_STRING env var (or the equivalent config key); telemetry is silently dropped when unset. The /generate endpoint emits a PlaygroundGenerate custom event tagged with outcome (success, generator_failed, timeout, exception, invalid_json, invalid_content_type, missing_fields, generator_missing) plus generatorName, codeModelSizeBytes, exitCode, generatedFileCount and durationMs. A PlaygroundGenerateDurationMs metric is also tracked per outcome, and unhandled exceptions are reported via TrackException. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jsquire
approved these changes
May 16, 2026
commit: |
Contributor
|
No changes needing a change description found. |
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.
Summary
Wires Application Insights telemetry into
packages/http-client-csharp/playground-serverso we can observe thecsharp-playground-serverApp Service in production.Changes
Microsoft.ApplicationInsights.AspNetCore(3.1.1) package reference.Program.cs. The connection string is read from the standardAPPLICATIONINSIGHTS_CONNECTION_STRINGenv var (or theApplicationInsights:ConnectionStringconfig key); when neither is set the SDK is a no-op and startup logsApplication Insights telemetry disabled../generateendpoint with aPlaygroundGeneratecustom event tagged with:outcome— one ofsuccess,generator_failed,timeout,exception,invalid_json,invalid_content_type,missing_fields,generator_missinggeneratorName,codeModelSizeBytes,exitCode,generatedFileCount,durationMsPlaygroundGenerateDurationMsmetric per outcome and report unhandled exceptions viaTrackException.Auto-collected request/dependency telemetry from the AspNetCore SDK is also enabled for free.
Deployment
No pipeline changes required — the existing deploy step (
az webapp config container set) just swaps the container image and leaves app settings alone. Telemetry only starts flowing onceAPPLICATIONINSIGHTS_CONNECTION_STRINGis set on thecsharp-playground-serverApp Service (one-time Azure config).