-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add experimental GitHub telemetry redirection across all SDKs #1835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MackinnonBuck
wants to merge
29
commits into
main
Choose a base branch
from
mackinnonbuck-sdk-github-telemetry-contract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,492
−69
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d2f5697
codegen: add notification flag to RpcMethod metadata
MackinnonBuck 8561b06
nodejs: add GitHub telemetry redirection support
MackinnonBuck fc5638a
dotnet: add GitHub telemetry redirection support
MackinnonBuck ca4c483
python: add GitHub telemetry redirection support
MackinnonBuck 276aa33
go: add GitHub telemetry redirection support
MackinnonBuck 119899a
rust: add GitHub telemetry redirection support
MackinnonBuck 5001268
java: add GitHub telemetry redirection support
MackinnonBuck 907eea1
Merge origin/main into mackinnonbuck-sdk-github-telemetry-contract
MackinnonBuck d1fb55a
Fix telemetry codegen after schema bump
MackinnonBuck c810cbd
Rename telemetry redirection to forwarding across SDKs
MackinnonBuck 6a24d89
Merge remote-tracking branch 'origin/main' into mackinnonbuck-sdk-git…
MackinnonBuck da54ca3
nodejs: align GitHub telemetry forwarding with cross-SDK contract
MackinnonBuck 85726bc
python: address telemetry review nits
MackinnonBuck 1c398a4
dotnet: observe expected exception in telemetry test teardown
MackinnonBuck 3f91f81
Merge origin/main into mackinnonbuck-sdk-github-telemetry-contract
MackinnonBuck dcef40e
go: format telemetry forwarding fields
MackinnonBuck bb65bd8
codegen: remove temporary GitHub telemetry schema overlay
MackinnonBuck a377339
Merge remote-tracking branch 'origin/main' into mackinnonbuck-sdk-git…
Copilot 7c49ebb
Reconcile Node/Python/Go telemetry glue with main's generated dispatch
Copilot 279a0be
Repoint Java telemetry glue at generated types; finish Rust/.NET reco…
Copilot d7fac92
codegen: restore notification dispatch for gitHubTelemetry.event
MackinnonBuck fa3fccb
test: guard gitHubTelemetry.event notification-style dispatch
MackinnonBuck e7d173e
test: clarify telemetry forwarding comment in e2e
MackinnonBuck 52099d1
test: use shared waitForCondition helper in telemetry e2e
MackinnonBuck b2a2567
test: add live gitHubTelemetry forwarding E2E for all languages
MackinnonBuck 8c40c1d
fix: guard gitHubTelemetry callbacks in Python and .NET adapters
MackinnonBuck 086b20d
test: normalize telemetry E2E line endings
MackinnonBuck d4781da
fix(java): log gitHubTelemetry callback errors at WARNING not SEVERE
MackinnonBuck 3f67d2c
fix(python): log gitHubTelemetry callback errors at WARNING not ERROR
MackinnonBuck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -281,6 +281,7 @@ private CopilotClientOptions(CopilotClientOptions? other) | |
| OnListModels = other.OnListModels; | ||
| SessionFs = other.SessionFs; | ||
| RequestHandler = other.RequestHandler; | ||
| OnGitHubTelemetry = other.OnGitHubTelemetry; | ||
| SessionIdleTimeoutSeconds = other.SessionIdleTimeoutSeconds; | ||
| EnableRemoteSessions = other.EnableRemoteSessions; | ||
| Mode = other.Mode; | ||
|
|
@@ -378,6 +379,14 @@ private CopilotClientOptions(CopilotClientOptions? other) | |
| [Experimental(Diagnostics.Experimental)] | ||
| public CopilotRequestHandler? RequestHandler { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Experimental. Receives GitHub telemetry events the runtime forwards to this | ||
| /// connection; setting a handler opts created/resumed sessions into forwarding. | ||
| /// </summary> | ||
| [Experimental(Diagnostics.Experimental)] | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public Action<Rpc.GitHubTelemetryNotification>? OnGitHubTelemetry { get; set; } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are other handlers sync or async? I'm wondering if this should be |
||
|
|
||
| /// <summary> | ||
| /// OpenTelemetry configuration for the runtime. | ||
| /// When set to a non-<see langword="null"/> instance, the runtime is started with OpenTelemetry instrumentation enabled. | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| using System.Collections.Concurrent; | ||
| using GitHub.Copilot.Rpc; | ||
| using GitHub.Copilot.Test.Harness; | ||
| using Xunit; | ||
| using Xunit.Abstractions; | ||
|
|
||
| namespace GitHub.Copilot.Test.E2E; | ||
|
|
||
| #pragma warning disable GHCP001 // GitHub telemetry forwarding is experimental. | ||
|
|
||
| public class GitHubTelemetryForwardingE2ETests(E2ETestFixture fixture, ITestOutputHelper output) | ||
| : E2ETestBase(fixture, "github_telemetry", output) | ||
| { | ||
| [Fact] | ||
| public async Task Should_Forward_GitHub_Telemetry_For_A_Live_Session() | ||
| { | ||
| var notifications = new ConcurrentQueue<GitHubTelemetryNotification>(); | ||
|
|
||
| await using var client = Ctx.CreateClient(options: new CopilotClientOptions | ||
| { | ||
| OnGitHubTelemetry = notifications.Enqueue, | ||
| }); | ||
|
|
||
| CopilotSession? session = null; | ||
| try | ||
| { | ||
| session = await client.CreateSessionAsync(new SessionConfig | ||
| { | ||
| OnPermissionRequest = PermissionHandler.ApproveAll, | ||
| }); | ||
|
|
||
| await TestHelper.WaitForConditionAsync( | ||
| () => !notifications.IsEmpty, | ||
| timeout: TimeSpan.FromSeconds(30), | ||
| timeoutMessage: "Timed out waiting for GitHub telemetry notification."); | ||
|
|
||
| Assert.True(notifications.TryPeek(out var notification)); | ||
| Assert.NotEmpty(notification.SessionId); | ||
| Assert.NotNull(notification.Event); | ||
| Assert.NotEmpty(notification.Event.Kind); | ||
| Assert.IsType<bool>(notification.Restricted); | ||
| } | ||
| finally | ||
| { | ||
| if (session is not null) | ||
| { | ||
| await session.DisposeAsync(); | ||
| } | ||
|
|
||
| await client.StopAsync(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #pragma warning restore GHCP001 |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.