Repository navigation
[Monitor Exporter] Keep the SDK statistics ikey on the distro endpoint - #63342
Merged
Rajkumar Rangaraj (rajkumar-rangaraj) merged 2 commits intoSep 23, 2026
Conversation
When the RouteSdkStatsToDistroEndpoint AppContext switch is on and the remote config returns a url, SDK statistics were sent with an all-zero placeholder instrumentation key. The distro changes only the destination: envelopes now carry the same region-matched SDK statistics instrumentation key as the existing endpoint. The ikey region is selected with the same rule as the config url. Legacy, fallback and override paths are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Rajkumar Rangaraj (rajkumar-rangaraj)
September 23, 2026 22:33
View session
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused internal fix is consistent with existing routing behavior and has comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes SDK statistics attribution when routing through distro-configured endpoints.
Changes:
- Preserves region-matched SDK statistics instrumentation keys.
- Shares EU-region selection logic across configuration URLs and keys.
- Adds regression tests and changelog documentation.
| File | Description |
|---|---|
CHANGELOG.md |
Documents the routing fix. |
StatsbeatConstants.cs |
Extracts EU and non-EU instrumentation keys. |
AzureMonitorStatsbeat.cs |
Uses the regional key for distro endpoints. |
DistroSdkStatsRoutingTests.cs |
Tests key selection and connection-string construction. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Matthew Sainsbury (Microsoft) (mattsains-msft)
approved these changes
Sep 23, 2026
Rajkumar Rangaraj (rajkumar-rangaraj)
merged commit Sep 23, 2026
3a8fb14
into
Azure:main
25 checks passed
This was referenced Oct 7, 2026
Open
Merged
Open
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.
Problem
With the
Azure.Monitor.OpenTelemetry.Exporter.RouteSdkStatsToDistroEndpointAppContext switch on, the exporter fetches{ "ver": 1, "enabled": true, "url": "..." }from the SDK statistics config endpoint. On theUseUrlpath,BuildConnectionStringFromHosthard-codedInstrumentationKey=00000000-0000-0000-0000-000000000000, so every SDK statistics envelope sent to the distro endpoint carried an all-zero iKey. The config contract has no ikey field; the distro is meant to change only the destination, while the ikey stays the same as other internal SDK statistics.Change
StatsbeatConstants: extractStatsbeat_InstrumentationKey_NonEU(c4a29126-...) andStatsbeat_InstrumentationKey_EU(7dc56bab-...). The legacy connection strings are composed from them and are byte-for-byte unchanged.AzureMonitorStatsbeat:UseUrlnow buildsInstrumentationKey={region-matched SDK stats ikey};IngestionEndpoint=https://{url}/.GetSdkStatsInstrumentationKeyshares oneIsEuRegioncheck withGetSdkStatsConfigUrl, so an EU customer gets the EU config host and the EU ikey; unknown regions default to non-EU for both.urlurlenabled: falseAPPLICATIONINSIGHTS_STATS_CONNECTION_STRINGThe customer ikey continues to be sent only as the
cikeydimension.Tests
New in
DistroSdkStatsRoutingTests:urlfor EU / non-EU / unknown region: exact resolved connection string, parsed ikey equals the SDK stats ikey, and is neither the customer's ikey nor all zeros (customer ikey in the test is non-zero so the checks are meaningful).BuildConnectionStringFromHostpreserves the ikey for bare host / trailing slash / full URL.Full exporter suite passes on net8.0 (1194);
DistroSdkStatsRoutingTestspass on net462.