Persist server OTLP tracing settings across restarts #1705
main fromrefs/pull/1705/head·merged by juliusmarminge View on GitHubSummary#
- Add shared helpers for parsing and normalizing persisted server observability settings.
- Resolve
otlpTracesUrlfrom 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.tsfor persisted observability parsing and normalization. - Unit coverage added in
apps/server/src/cli-config.test.tsandapps/server/src/serverSettings.test.tsfor 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.
Note
Persist server OTLP tracing settings across restarts#
- Adds
ObservabilitySettings(withotlpTracesUrlandotlpMetricsUrl) to theServerSettingsschema in settings.ts and exposes reusable parsing helpers in serverSettings.ts. - The desktop main process reads persisted observability settings from
STATE_DIR/settings.jsonbefore spawning the backend and injects the URLs into the bootstrap envelope. - The server's
resolveServerConfigresolves 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
WeakSetin main.ts.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
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).juliusmarminge merged thise9ed849
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
057be605-a2dd-42c6-b90c-f15840031b54You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.