Skip to content
Source
Sign inSign up
pingdotgg/t3code

Persist server OTLP tracing settings across restarts #1705

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/1705/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

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](https://cursor.com/dashboard?tab=bugbot) for commit a0effd5c1b8d2b4e0b25bfa829fb5a5654a2fe06. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).

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.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged thise9ed849

    5. juliusmarminge closed this

Sign in to join this conversation.