Skip to content

[release/9.0.3xx] Use full Application Insights connection string instead of instrumentation key#55180

Open
nagilson wants to merge 1 commit into
dotnet:release/9.0.3xxfrom
nagilson:nagilson-conn-string-9.0.3xx
Open

[release/9.0.3xx] Use full Application Insights connection string instead of instrumentation key#55180
nagilson wants to merge 1 commit into
dotnet:release/9.0.3xxfrom
nagilson:nagilson-conn-string-9.0.3xx

Conversation

@nagilson

@nagilson nagilson commented Jul 7, 2026

Copy link
Copy Markdown
Member

Backport of #55127 to release/9.0.3xx.

The SDK telemetry client was configured with an Application Insights connection string that only contained the bare InstrumentationKey. When only an instrumentation key is supplied, the Azure Monitor client must resolve the ingestion/live endpoints at runtime, which adds an extra network round-trip on every POST of telemetry. Supplying the full connection string (with IngestionEndpoint, LiveEndpoint, and ApplicationId) removes that round-trip.

Instrumentation-key-only configuration is also the legacy approach; Azure Monitor has moved to connection strings. See the Microsoft Learn documentation: https://learn.microsoft.com/azure/azure-monitor/app/connection-strings

Motivation and measurements are in #55127 (and #55126). The telemetry code was substantially refactored in main, so this could not be cherry-picked cleanly; the equivalent one-line change is applied to src/Cli/dotnet/Telemetry/Telemetry.cs on this branch.


Tactics

Summary

Switches the SDK telemetry client from an instrumentation-key-only Application Insights connection string to the full connection string (including IngestionEndpoint, LiveEndpoint, and ApplicationId). Connection strings are the current Azure Monitor standard and are ~200ms faster to POST because the ingestion endpoints no longer have to be resolved from a bare instrumentation key at runtime. We have moved on from instrumentation keys to connection strings (https://learn.microsoft.com/azure/azure-monitor/app/connection-strings). This is a one-line change to src/Cli/dotnet/Telemetry/Telemetry.cs, backporting #55127.

Customer Impact

Improves the time to POST telemetry (~200ms faster per post) and improves data consistency, since telemetry is sent directly to the correct ingestion/live endpoints rather than relying on endpoint resolution from a bare instrumentation key. There is no customer-facing behavior change other than reduced telemetry overhead.

Regression?

No. This is not a regression; it is a performance and correctness improvement to how telemetry is posted.

Testing

Tested by posting telemetry using curl and by running existing SDK versions that carry the same fix, confirming telemetry is ingested correctly with the full connection string and that the POST cost is reduced (~250-300ms with the full connection string vs. ~535-557ms with the instrumentation-key-only string, as measured in #55127).

Risk

Low. The change is a single-line update to the telemetry connection string constant. The connection string points to the same Application Insights resource (same instrumentation key), only adding the explicit endpoint/application metadata. See #54613 for an example of the tactics template.

…ation key

Backport of dotnet#55127.

Use the proper Application Insights connection string (including
IngestionEndpoint, LiveEndpoint, and ApplicationId) instead of an
instrumentation-key-only connection string. Resolving the endpoints from a
bare instrumentation key requires an extra network round-trip; supplying the
full connection string shaves 200+ms off the cost to POST telemetry.

See dotnet#55127 for motivation and measurements.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit e17b6fc)
Copilot AI review requested due to automatic review settings July 7, 2026 18:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Backports a small telemetry configuration update to release/9.0.3xx so the CLI telemetry client uses a full Application Insights connection string (including explicit ingestion/live endpoints) instead of an instrumentation-key-only connection string.

Changes:

  • Update the telemetry ConnectionString constant to include IngestionEndpoint, LiveEndpoint, and ApplicationId metadata alongside the existing InstrumentationKey.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants