Skip to content

feat(observability): honor an OpenTelemetry kill switch in the environment - #12925

Open
yordis wants to merge 7 commits into
pingdotgg:mainfrom
TrogonStack:yordis/feat-otel-sdk-disabled
Open

yordis wants to merge 7 commits into
pingdotgg:mainfrom
TrogonStack:yordis/feat-otel-sdk-disabled

Conversation

@yordis

@yordis yordis commented Sep 21, 2026

Copy link
Copy Markdown
Contributor
  • A machine that turns telemetry off for every other process on it expects one more process to join in without being told twice. T3 Code kept exporting anyway, because OTEL_SDK_DISABLED is only read inside the Effect library's layerFromConfig, and T3 Code builds each exporter explicitly instead.
  • Inheriting OTEL_SDK_DISABLED from a shell profile is common, so T3 Code's own name is read first. Without a name of its own the only way to get T3 Code's telemetry back would be to unset a variable the rest of the machine depends on.
  • The specification recognizes only the string true and forbids implementations from extending that, so OTEL_SDK_DISABLED=1 has to leave export running. It also asks for a warning when that happens, because a value being read as the opposite of what it looks like is the whole hazard of these variables. T3 Code's own name is not bound by that and accepts the same values as every other T3CODE_* boolean.
  • The server and the desktop main process are separate producers, and a switch that stopped only one of them would be the more confusing half of a feature.
  • Carved out of feat(observability): honor the standard OTEL_* environment variables #12621, which is the same reader grown to the rest of the standard variables. This part stands alone: it decides nothing about endpoints, so it needs no precedence rules and makes no new egress decision.

Summary by CodeRabbit

  • New Features

    • Added environment-variable controls to disable OpenTelemetry exports across desktop, server, and WSL processes.
    • Added support for T3CODE_OTEL_SDK_DISABLED, which takes precedence over OTEL_SDK_DISABLED.
    • When disabled, configured OTLP endpoints are ignored.
  • Bug Fixes

    • Ensured telemetry disablement is consistently propagated across WSL boundaries.
    • Added startup warnings for unsupported or invalid switch values.
  • Documentation

    • Documented supported values, precedence rules, and behavior of the observability kill switches.

…nment

A machine that turns telemetry off for every other process on it expects one more process to join in without being told twice, and T3 Code kept exporting anyway. Its own name is read first so getting T3 Code's telemetry back does not mean unsetting a variable the rest of the machine depends on.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@github-actions github-actions Bot added the size:L 100-499 changed lines (additions + deletions). label Sep 21, 2026
…ean what it looks like

The specification asks for a warning whenever a boolean value other than true or false is read, because being silently read as the opposite of its apparent meaning is the whole hazard of these values. T3 Code's own name also answered to a narrower set of values than every other T3CODE_ boolean in the codebase.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@macroscopeapp

macroscopeapp Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a cross-cutting environment-controlled kill switch that changes existing server and desktop telemetry export behavior and propagates across the WSL boundary. It also introduces static-analysis suppression directives, warranting human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 2aeec12c-60e9-48e4-be4d-6e0b8b5788ce

📥 Commits

Reviewing files that changed from the base of the PR and between 1de563c and ab2824a.

📒 Files selected for processing (17)
  • apps/desktop/src/app/DesktopObservability.test.ts
  • apps/desktop/src/app/DesktopObservability.ts
  • apps/desktop/src/backend/DesktopBackendConfiguration.test.ts
  • apps/desktop/src/backend/DesktopBackendConfiguration.ts
  • apps/server/src/bin.test.ts
  • apps/server/src/cli/config.test.ts
  • apps/server/src/cli/config.ts
  • apps/server/src/cli/pair.ts
  • apps/server/src/config.ts
  • apps/server/src/environment/ServerEnvironment.test.ts
  • apps/server/src/observability/Layers/Observability.ts
  • apps/server/src/server.test.ts
  • apps/server/src/serverLogger.test.ts
  • docs/operations/observability.md
  • packages/shared/package.json
  • packages/shared/src/otelEnvironment.test.ts
  • packages/shared/src/otelEnvironment.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds shared OpenTelemetry kill-switch parsing. Server and desktop endpoint resolution now honor the disabled state, log parsing warnings, forward the variables through WSL, and include test coverage and operational documentation.

Changes

OpenTelemetry export kill switch

Layer / File(s) Summary
Shared OpenTelemetry environment loader
packages/shared/src/otelEnvironment.ts, packages/shared/src/otelEnvironment.test.ts, packages/shared/package.json
The shared module reads T3CODE_OTEL_SDK_DISABLED and OTEL_SDK_DISABLED, applies precedence and boolean parsing rules, returns warnings, and exposes the new module entry point.
Server configuration and observability integration
apps/server/src/config.ts, apps/server/src/cli/config.ts, apps/server/src/observability/Layers/Observability.ts, apps/server/src/cli/pair.ts, apps/server/src/*test.ts
Server configuration stores the resolved OpenTelemetry environment. Disabled environments omit OTLP endpoints. Observability logs warnings. Pairing and test configurations provide OtelEnvironment.none.
Desktop export suppression and WSL propagation
apps/desktop/src/app/DesktopObservability.ts, apps/desktop/src/app/DesktopObservability.test.ts, apps/desktop/src/backend/DesktopBackendConfiguration.ts, apps/desktop/src/backend/DesktopBackendConfiguration.test.ts, docs/operations/observability.md
Desktop endpoint resolution omits all OTLP endpoints when disabled. WSL forwards both kill-switch variables. Tests and documentation cover precedence, accepted values, warnings, and persisted endpoint handling.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant ServerConfig
  participant ObservabilityLive
  participant OTLPExporter
  Environment->>ServerConfig: Provide OpenTelemetry kill-switch variables
  ServerConfig->>ServerConfig: Resolve disabled state and OTLP URLs
  ServerConfig->>ObservabilityLive: Provide otelEnvironment and endpoints
  ObservabilityLive->>ObservabilityLive: Log warnings
  ObservabilityLive-->>OTLPExporter: Configure enabled or omitted exports
Loading

Suggested reviewers: juliusmarminge, t3dotgg

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the motivation and key behavior, but it does not follow the required template. It omits the What Changed and Why headings and the Checklist section. Rewrite the description using the required What Changed, Why, and Checklist sections. Include the checklist items and state that UI Changes are not applicable, or remove that section as permitted by the template.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: support for an OpenTelemetry environment kill switch.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Sep 21, 2026
Comment thread packages/shared/src/otelEnvironment.ts Outdated
The list reads as though OpenTelemetry defined it. It does not: the specification recognizes one true spelling and forbids adding more, so these are Config.Boolean's literals and apply only to T3 Code's own name.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…at imposes it

The narrow value set on OTEL_SDK_DISABLED is not a T3 Code convention, so it should not read as one: it is the specification forbidding implementations from accepting anything but the string true, and that is what an operator needs to know to stop trying OTEL_SDK_DISABLED=1.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
A reviewer read the trim as accidental, and the answer is worth keeping: padding is not something the operator typed, so dropping it before the comparison is what makes a value mean what it says.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Comment thread packages/shared/src/otelEnvironment.ts Outdated

@macroscopeapp macroscopeapp Bot 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.

All clear

Posted via Macroscope — Effect Service Conventions

@macroscopeapp

macroscopeapp Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

All clear

Posted via Macroscope — Effect Service Conventions

The rule about which strings are a yes belongs in a value object rather than in the reader that happens to need it, and the spec rule and ours then read the same way instead of looking like one decision.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
A switch that silences this process while the server it launched keeps exporting is worse than no switch, and nothing crosses wsl.exe that WSLENV does not declare.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis

yordis commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

@juliusmarminge send the 🐶 doggy out!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant