Skip to content

Add OTLP protocol telemetry options#1648

Merged
stephentoub merged 4 commits into
github:mainfrom
loganrosen:loganrosen/add-otlp-protocol-options
Jun 16, 2026
Merged

Add OTLP protocol telemetry options#1648
stephentoub merged 4 commits into
github:mainfrom
loganrosen:loganrosen/add-otlp-protocol-options

Conversation

@loganrosen

@loganrosen loganrosen commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a global OTLP HTTP protocol telemetry config option across Node.js, Python, Go, .NET, Java, and Rust SDKs.
  • Map the option to OTEL_EXPORTER_OTLP_PROTOCOL when the SDK spawns the Copilot CLI.
  • Document JSON/protobuf protocol selection and update focused mapping tests.

Testing

  • just format
  • cd java && mvn spotless:apply
  • cd nodejs && npm test -- --run test/telemetry.test.ts test/e2e/client_options.e2e.test.ts -t "TelemetryConfig env var mapping|should propagate process options"
  • cd nodejs && npm test -- --run test/e2e/client_options.e2e.test.ts -t "should propagate process options"
  • cd python && uv run pytest test_telemetry.py e2e/test_client_options_e2e.py::TestClientOptions::test_should_propagate_process_options_to_spawned_cli e2e/test_telemetry_e2e.py::TestTelemetryConfig -q
  • cd go && go test . && go test ./internal/e2e -run 'TestTelemetryConfigUnit|TestClientOptionsE2E/should_propagate_process_options_to_spawned_cli'
  • cd dotnet && dotnet test test/GitHub.Copilot.SDK.Test.csproj --filter "FullyQualifiedName~GitHub.Copilot.Test.Unit.TelemetryTests|FullyQualifiedName~Should_Propagate_Process_Options_To_Spawned_Cli"
  • cd rust && cargo test --features test-support --lib otlp_http_protocol_serde_matches_env_value && cargo test --features test-support --lib telemetry_config && cargo test --features test-support --lib build_command
  • cd java && mvn verify

Note: full auth-dependent local E2E runs hit harness/auth isolation without GITHUB_ACTIONS=true, so validation focused on the affected telemetry mapping paths.

Expose OTLP HTTP protocol selection through each SDK telemetry config and map the values to the standard OpenTelemetry protocol environment variables when spawning the Copilot CLI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread dotnet/src/Types.cs Outdated
Keep the SDK telemetry API focused on the global OTLP HTTP protocol option and rely on direct environment variables for uncommon signal-specific overrides.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@loganrosen loganrosen marked this pull request as ready for review June 15, 2026 20:06
@loganrosen loganrosen requested a review from a team as a code owner June 15, 2026 20:06
Copilot AI review requested due to automatic review settings June 15, 2026 20:06

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for configuring the OTLP/HTTP protocol used by the spawned CLI’s OpenTelemetry exporter via a new otlp_protocol / otlpProtocol option across SDKs and docs.

Changes:

  • Introduce an OTLP protocol option in each SDK’s TelemetryConfig, and propagate it to OTEL_EXPORTER_OTLP_PROTOCOL when spawning the CLI.
  • Update unit/E2E tests to cover the new env var mapping.
  • Update READMEs and observability docs to document the new option and its allowed values.
Show a summary per file
File Description
rust/src/lib.rs Adds OtlpHttpProtocol enum and plumbs otlp_protocol into CLI env var injection + tests.
rust/README.md Documents Rust usage of OtlpHttpProtocol and mentions the new env var.
python/copilot/client.py Extends TelemetryConfig TypedDict and forwards OTEL_EXPORTER_OTLP_PROTOCOL on spawn.
python/test_telemetry.py Updates unit test mapping for telemetry env vars to include protocol.
python/e2e/test_telemetry_e2e.py Extends E2E coverage for default/unset and set telemetry protocol.
python/e2e/test_client_options_e2e.py Ensures protocol is propagated to the spawned CLI in E2E.
python/README.md Documents otlp_protocol option and allowed values.
nodejs/src/types.ts Adds otlpProtocol to TS TelemetryConfig type.
nodejs/src/client.ts Propagates otlpProtocol into OTEL_EXPORTER_OTLP_PROTOCOL for spawned CLI.
nodejs/test/telemetry.test.ts Extends env var mapping tests to include OTLP protocol.
nodejs/test/e2e/client_options.e2e.test.ts Validates protocol propagation in E2E capture.
nodejs/README.md Documents otlpProtocol option and allowed values.
java/src/main/java/com/github/copilot/rpc/TelemetryConfig.java Adds otlpProtocol field + getter/setter with Javadoc.
java/src/main/java/com/github/copilot/CliServerManager.java Injects OTEL_EXPORTER_OTLP_PROTOCOL into ProcessBuilder env.
java/src/test/java/com/github/copilot/TelemetryConfigTest.java Adds unit coverage for otlpProtocol getter/setter + fluent chaining.
java/src/test/java/com/github/copilot/CliServerManagerTest.java Updates telemetry setup in tests to include protocol.
go/types.go Adds OTLPProtocol field to Go TelemetryConfig.
go/client.go Injects OTEL_EXPORTER_OTLP_PROTOCOL into the CLI process env.
go/internal/e2e/telemetry_e2e_test.go Extends telemetry config tests for default/unset and set protocol.
go/internal/e2e/client_options_e2e_test.go Ensures protocol is propagated in E2E env capture.
go/README.md Documents OTLPProtocol option and allowed values.
dotnet/src/Types.cs Adds OtlpProtocol property with XML docs.
dotnet/src/Client.cs Injects OTEL_EXPORTER_OTLP_PROTOCOL into spawned CLI env.
dotnet/test/Unit/TelemetryTests.cs Extends unit tests for default/unset and set protocol.
dotnet/test/E2E/ClientOptionsE2ETests.cs Validates protocol propagation in E2E env capture.
dotnet/README.md Documents OtlpProtocol option and allowed values.
docs/observability/opentelemetry.md Adds protocol option to the cross-SDK table and explains expected values.
docs/getting-started.md Adds protocol option to the getting-started telemetry table and guidance.

Copilot's findings

  • Files reviewed: 28/28 changed files
  • Comments generated: 4

Comment thread rust/src/lib.rs
Comment thread rust/src/lib.rs
Comment thread python/copilot/client.py Outdated
Comment thread docs/observability/opentelemetry.md Outdated
loganrosen and others added 2 commits June 15, 2026 16:13
Narrow the Python OTLP protocol type, avoid hardcoding the CLI default in docs, and add Rust serde coverage tying protocol wire values to env values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wrap the OTLP protocol TypedDict docstring so Python CI lint passes.

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

@stephentoub stephentoub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks

@stephentoub stephentoub added this pull request to the merge queue Jun 16, 2026
Merged via the queue into github:main with commit b5ce1c8 Jun 16, 2026
39 checks passed
@loganrosen loganrosen deleted the loganrosen/add-otlp-protocol-options branch June 17, 2026 22:07
krukow added a commit to copilot-community-sdk/copilot-sdk-clojure that referenced this pull request Jun 18, 2026
* chore(schema): bump CLI schema 1.0.61 -> 1.0.63 and regenerate

Pins @github/copilot to 1.0.63 and regenerates generated/event_specs.clj
from the refreshed JSON Schemas. Pulls in new wire surface: the
session.todos_changed event, optional AssistantUsageData fields
(contentFilterTriggered, finishReason), ToolExecutionCompleteResult
structuredContent, ToolExecutionStartData toolDescription, and the
plugin/session ExtensionSource values.

Upstream: github/copilot-sdk#1686 (1.0.63),
commit a115246a (1.0.62).

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

* feat(sync): port post-v1.0.1 config, lifecycle, and event additions

Adds the public-SDK surface introduced upstream after v1.0.1:

- :memory session config ({:enabled boolean}) forwarded on both
  create-session and resume-session, omitted when unset.
  github/copilot-sdk#1617
- :otlp-protocol telemetry option mapped to OTEL_EXPORTER_OTLP_PROTOCOL.
  github/copilot-sdk#1648
- Graceful runtime.shutdown in stop! for SDK-owned processes, bounded by
  a 10s timeout; force-stop! left unchanged.
  github/copilot-sdk#1667
- :mcp-defer-tools (#{:auto :never}) on MCP stdio/http server configs,
  rendered as deferTools on the wire (1.0.63 schema).
- :token-prices on ::model-billing.
  github/copilot-sdk#1633
- Optional event-data fields surfaced by the 1.0.63 schema
  (assistant.usage content-filter/finish-reason,
  tool.execution_complete structured-content) and the
  :copilot/session.todos_changed public event.

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

* test(sync): cover memory, otlp, graceful shutdown, and deferTools

Adds integration coverage for the new session config and wire mappings,
mock-server handling for the runtime.shutdown RPC, and process-level
assertions for graceful termination ordering.

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

* docs(sync): document new config and bump version to 1.0.1.1

Documents :memory, :otlp-protocol, MCP :defer-tools, :token-prices,
the session.todos_changed event, and graceful shutdown across API.md,
the MCP overview, and CHANGELOG. Bumps the Clojure patch to 1.0.1.1.

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

* fix(sync): address Copilot review feedback

Resolve four findings from the Copilot Code Review bot on PR #139:

- process.clj: preserve the thread interrupt flag in wait-for-exit!.
  .waitFor throws InterruptedException (a subclass of Exception), so the
  generic catch was swallowing it and clearing the interrupt flag. Catch
  it separately and re-set the flag via (.interrupt (Thread/currentThread))
  so callers still observe cancellation.
- util.clj: correct the mcp-server->wire docstring example. clj->wire
  produces camelCase keyword keys, not string keys.
- specs.clj: fix the memory-config comment to cite upstream PR #1617
  (not #1638).
- CHANGELOG.md: drop the nonexistent ::memory-enabled spec reference;
  only ::memory exists (reusing the existing ::enabled spec).

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

* docs(sync): drop non-exposed RPC method reference from todos_changed row

The session.todos_changed event reference pointed Clojure users at
session.plan.readSqlTodosWithDependencies(), a TS-style method call for
an @experimental upstream method this SDK does not expose. Reword the row
as signal-only with no payload, consistent with how the rest of the doc
names JSON-RPC methods.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants