Skip to content

Persist server OTLP tracing settings across restarts#1705

Merged
juliusmarminge merged 4 commits intomainfrom
t3code/tracing-toggle-ui
Apr 3, 2026
Merged

Persist server OTLP tracing settings across restarts#1705
juliusmarminge merged 4 commits intomainfrom
t3code/tracing-toggle-ui

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 3, 2026

Summary

  • Add shared helpers for parsing and normalizing persisted server observability settings.
  • Resolve otlpTracesUrl from env vars, bootstrap data, or persisted settings so desktop/server restarts retain tracing config.
  • Extend server settings contracts and UI defaults to include observability settings.
  • Add tests for persisted settings parsing, config precedence, and trimming on save.

Testing

  • Not run (PR summary only).
  • Unit coverage added in packages/shared/src/serverSettings.test.ts for persisted observability parsing and normalization.
  • Unit coverage added in apps/server/src/cli-config.test.ts and apps/server/src/serverSettings.test.ts for config precedence and settings persistence.

Note

Medium Risk
Updates server config resolution and desktop backend bootstrap behavior to source OTLP endpoints from persisted settings.json, which can affect telemetry/export behavior and startup/restart flows. Also changes desktop backend shutdown handling to avoid unintended restarts, which could impact reliability if misclassified exits occur.

Overview
Persists OTLP observability endpoints (otlpTracesUrl, otlpMetricsUrl) in ServerSettings and introduces shared helpers (@t3tools/shared/serverSettings) to leniently parse/normalize these values from the on-disk settings.json.

Server startup config now resolves OTLP URLs with precedence env vars → desktop bootstrap envelope → persisted settings file, and the desktop app reads the persisted settings on launch/restart and injects OTLP URLs into the backend bootstrap payload so tracing config survives restarts.

Desktop backend lifecycle handling is adjusted to track intentionally-stopped child processes (expectedBackendExitChildren) so stopBackend/stopBackendAndWaitForExit no longer trigger automatic restart logic; tests are added/updated to cover parsing, trimming-on-save, and precedence behavior.

Written by Cursor Bugbot for commit a0effd5. This will update automatically on new commits. Configure here.

Note

Persist server OTLP tracing settings across restarts

  • Adds ObservabilitySettings (with otlpTracesUrl and otlpMetricsUrl) to the ServerSettings schema in settings.ts and exposes reusable parsing helpers in serverSettings.ts.
  • The desktop main process reads persisted observability settings from STATE_DIR/settings.json before spawning the backend and injects the URLs into the bootstrap envelope.
  • The server's resolveServerConfig resolves OTLP URLs with explicit precedence: environment variables → bootstrap envelope → persisted settings file.
  • Fixes unintended backend restart scheduling on shutdown by tracking expected exits via a WeakSet in main.ts.

Macroscope summarized a0effd5.

- Add shared observability settings parsing and schema support
- Load persisted OTLP traces URL in the server and desktop bootstrap
- Update UI defaults and tests for settings persistence

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 057be605-a2dd-42c6-b90c-f15840031b54

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/tracing-toggle-ui

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

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 3, 2026
- Persist metrics URL alongside traces URL
- Thread metrics config through desktop and server bootstrap
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 3, 2026

Approvability

Verdict: Needs human review

This PR introduces a new capability (persisting OTLP observability settings across restarts) that modifies how the desktop app configures the backend on startup. While the implementation is clean with good test coverage, the addition of new persistent state and changes to the startup flow warrant human review to confirm the behavior matches expectations.

You can customize Macroscope's approvability policy. Learn more.

- Remove `T3CODE_OTLP_METRICS_URL` from backend child env
- Default persisted observability settings to include `otlpMetricsUrl`
@juliusmarminge juliusmarminge merged commit e9ed849 into main Apr 3, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the t3code/tracing-toggle-ui branch April 3, 2026 03:33
gigq pushed a commit to gigq/t3code that referenced this pull request Apr 6, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
Chrono-byte pushed a commit to Chrono-byte/t3code that referenced this pull request Apr 7, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
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