Repository navigation
Fix #3223: WEB activity processors write tag keys the Azure Monitor exporter maps - #3224
Merged
Rajkumar Rangaraj (rajkumar-rangaraj) merged 5 commits intoOct 8, 2026
Merged
Conversation
UserActivityProcessor, SessionActivityProcessor, SyntheticUserAgentActivityProcessor, WebTestActivityProcessor and AccountIdActivityProcessor wrote tag keys that Azure.Monitor.OpenTelemetry.Exporter does not map, so the values were exported as custom properties and user_Id, session_Id, operation_SyntheticSource and user_AccountId stayed empty. - Use SemanticConventions.AttributeEnduserPseudoId, AttributeMicrosoftSessionId, AttributeMicrosoftSyntheticSource and AttributeMicrosoftUserAccountId for both the SetTag calls and the already-set guards. - AccountIdActivityProcessor now guards on the account key instead of enduser.id, which AuthenticatedUserIdActivityProcessor had already set from the same cookie. - Stop emitting the unmapped session.isFirst tag. - Add tests that run the processors through the Azure Monitor exporter and assert on the exported envelope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Rajkumar Rangaraj (rajkumar-rangaraj)
September 29, 2026 21:11
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The mapped keys, processor precedence, account regression, and exported envelopes are covered consistently without unresolved issues.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes WEB activity processors so user, session, synthetic-source, and account context values map correctly through the Azure Monitor exporter.
Changes:
- Replaces unmapped tag keys with shared
SemanticConventionskeys. - Corrects account-ID guarding and removes the unmapped
session.isFirsttag. - Updates unit tests and adds exporter-level regression coverage.
| File | Description |
|---|---|
WEB/Src/Web/Web/WebTestActivityProcessor.cs |
Uses exporter-mapped web-test context keys. |
WEB/Src/Web/Web/UserActivityProcessor.cs |
Uses the mapped anonymous-user key. |
WEB/Src/Web/Web/SyntheticUserAgentActivityProcessor.cs |
Uses the mapped synthetic-source key. |
WEB/Src/Web/Web/SessionActivityProcessor.cs |
Uses the mapped session key and removes session.isFirst. |
WEB/Src/Web/Web/AccountIdActivityProcessor.cs |
Corrects the account guard and mapped key. |
WEB/Src/Web/Web.Tests/WebTestActivityProcessorTests.cs |
Updates web-test key assertions. |
WEB/Src/Web/Web.Tests/UserActivityProcessorTests.cs |
Updates anonymous-user assertions. |
WEB/Src/Web/Web.Tests/SyntheticUserAgentActivityProcessorTests.cs |
Updates synthetic-source assertions. |
WEB/Src/Web/Web.Tests/SessionActivityProcessorTests.cs |
Verifies mapped session output and removed tags. |
WEB/Src/Web/Web.Tests/AccountIdActivityProcessorTests.cs |
Adds account guard regressions. |
WEB/Src/Web/Web.Tests/ActivityProcessorExportTests.cs |
Adds end-to-end exporter mapping tests. |
CHANGELOG.md |
Documents the corrected telemetry mappings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Harsimar Kaur (harsimar)
approved these changes
Oct 8, 2026
Rajkumar Rangaraj (rajkumar-rangaraj)
deleted the
rajrang/fixWebProcessorTagKeys
branch
October 8, 2026 23:21
This was referenced Oct 12, 2026
Closed
Merged
This was referenced Oct 27, 2026
Closed
This was referenced Nov 4, 2026
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.
Fix Issue #3223.
Changes
Five of the WEB package's activity processors wrote tag keys that
Azure.Monitor.OpenTelemetry.Exporterdoesn't map. The exporter exported those values as custom properties, souser_Id,session_Id,operation_SyntheticSourceanduser_AccountIdstayed empty after upgrading from 2.x.UserActivityProcessorai.user.idenduser.pseudo.idSessionActivityProcessorsession.id(+session.isFirst)microsoft.session.idSyntheticUserAgentActivityProcessorai.operation.syntheticSourcemicrosoft.synthetic_sourceWebTestActivityProcessorai.operation.syntheticSource,ai.user.id,session.idmicrosoft.synthetic_source,enduser.pseudo.id,microsoft.session.idAccountIdActivityProcessorenduser.accountmicrosoft.user.account_idSemanticConventionsconstants, whichTelemetryContextActivityProcessoralready uses, in both theSetTagcalls and the "already set" guards.WebTestActivityProcessoris registered beforeSyntheticUserAgentActivityProcessor, so with the shared key an availability test's source still takes precedence over the bot check.AccountIdActivityProcessorcheckedenduser.idas its "already set" guard.AuthenticatedUserIdActivityProcessorruns just before it and setsenduser.idfrom the sameai_authUsercookie, so the account ID was always skipped when that cookie was present. The guard now checks the account key.SessionActivityProcessorno longer emitssession.isFirst. The exporter doesn't map it, so it only showed up as a stray custom dimension.Tests
AccountIdActivityProcessorTestsregression tests: the account ID is set whenenduser.idis already present, and an existing account ID is not overwritten.ActivityProcessorExportTests. It runs the processors, in production registration order, throughAddAzureMonitorTraceExporterwith a capturingHttpPipelineTransport, then asserts on the exported envelope's context tags and that none of the keys appear incustomDimensions. It also covers availability-test precedence over the bot user agent and cookies. Against the old processor code these tests fail. With this fix, all 131 Web tests pass locally (net462).Checklist
For significant contributions please make sure you have completed the following items: