Skip to content

Collect copilot telemetry correlation - fixes #57104 - #57106

Merged
JanKrivanek merged 3 commits into
mainfrom
dev/jankrivanek/copilot-correlation
Nov 18, 2026
Merged

JanKrivanek merged 3 commits into
mainfrom
dev/jankrivanek/copilot-correlation

Conversation

@JanKrivanek

Copy link
Copy Markdown
Member

Motivation

#57104
tl;dr;: ability to correlate sdk and cpilot telemetry

Implementation

Collect the COPILOT_AGENT_SESSION_ID from env block.
Mimick the parsing and hashing logic performed by copilot runtime prior sending to their telemetry backend

Copilot AI balanced review requested due to automatic review settings November 13, 2026 19:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 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 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.

🔵 Needs a closer look

The pinned Copilot runtime source returns 404, leaving the core cross-product UUID acceptance, normalization, and hashing contract unconfirmed pending verification by a maintainer with access.

No open issues 🎉

What changed in this PR

Adds Copilot session correlation to .NET SDK telemetry, addressing #57104 so SDK events can be linked to the originating Copilot session.

Changes:

  • Captures COPILOT_AGENT_SESSION_ID per event, preserving recognized UUIDs, hashing other values, and recording not_present when absent.
  • Adds tests for normalization, telemetry opt-out, queued events, and session changes in reused MSBuild hosts.
  • Documents the correlation field while preserving existing SDK session IDs and opt-out behavior.
File Description
test/​dotnet.Tests/​TelemetryTests/​TelemetryHostMatrixTests.cs Checks correlation across build hosts and reused-server requests.
test/​dotnet.Tests/​TelemetryTests/​TelemetryClientTests.cs Covers normalization, opt-out, and per-event capture.
src/​Common/​EnvironmentVariableNames.cs Defines the Copilot session environment variable name.
src/​Cli/​dotnet/​Telemetry/​TelemetryClient.cs Captures, normalizes, and attaches Copilot correlation to events.
documentation/​project-docs/​telemetry.md Documents the field, normalization, and missing-value semantics.

Review effort: Balanced

@baronfel baronfel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is the right approach - this should just get added to the 'telemetry common properties'. The TelemetryClient doesn't actually know anything about the telemetry we send, it's just the sender part of the system. The Common Properties are where we actually collect data to be sent.

@JanKrivanek
JanKrivanek marked this pull request as draft November 14, 2026 10:15
auto-merge was automatically disabled November 14, 2026 10:15

Pull request was converted to draft

@JanKrivanek
JanKrivanek force-pushed the dev/jankrivanek/copilot-correlation branch from 582b4de to 79f01ac Compare November 14, 2026 10:28
…d on suggestion by @baronfel

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JanKrivanek
JanKrivanek force-pushed the dev/jankrivanek/copilot-correlation branch from 79f01ac to 1dd4c48 Compare November 14, 2026 10:54
@JanKrivanek
JanKrivanek marked this pull request as ready for review November 14, 2026 20:56
@JanKrivanek

JanKrivanek commented Nov 14, 2026 •

Copy link
Copy Markdown
Member Author

I don't think this is the right approach - this should just get added to the 'telemetry common properties'. The TelemetryClient doesn't actually know anything about the telemetry we send, it's just the sender part of the system. The Common Properties are where we actually collect data to be sent.

Good point!

Moved the logic. The actual invocation stays in client (similar to how s_commonProperties are added)

@JanKrivanek
JanKrivanek requested a review from baronfel November 14, 2026 21:00
Telemetry common-property collection now reads COPILOT_AGENT_SESSION_ID. Explicitly return null in the seeded-session and first-use test fixtures so their strict mocks model commands without Copilot context. Preserve existing assertions and opt-out cases.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

This PR has been labeled with Area-Telemetry. Please ensure that any telemetry changes in this PR

@JanKrivanek
JanKrivanek merged commit c0786c8 into main Nov 18, 2026
26 checks passed
@JanKrivanek
JanKrivanek deleted the dev/jankrivanek/copilot-correlation branch November 18, 2026 09:00
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.

3 participants