Server observability has three outputs: pretty stdout logs (not persisted locally, except SSH-managed launches at ~/.t3/ssh-launch/<state>/server.log), a local NDJSON trace file (always on), and optional OTLP export (traces, metrics, logs).
Default trace paths (server.trace.ndjson):
- Production / explicit
--home-dir/T3CODE_HOME:<home>/userdata/logs/server.trace.ndjson - Linked worktree dev run:
<worktree>/.t3/userdata/logs/server.trace.ndjson - Non-worktree dev run:
~/.t3/dev/logs/server.trace.ndjson
Summarize counts, rates, and latency percentiles offline (even while a server is stalled or stopped):
t3 trace summary --since 30m --limit 40
# Set T3CODE_TRACE_FILE=/path/to/server.trace.ndjson for dev or copied tracesLogs emitted inside an active span (Effect.log*) attach as span events unless T3CODE_OTLP_LOGS_URL is configured (which exports all log records directly to avoid duplicates).
Event-loop stalls (>2 s) write server.eventLoop.stall spans and append to event-loop-stalls.ndjson beside the trace file. SQLite spans carry db.connection (writer/reader) and db.lock_wait_ms (queue wait off the event loop—subtract it before blaming query speed). Metrics live only in-process unless OTLP export is enabled.
At trace level Info or above (the default), with timing enabled, the local server file samples routine spans: SQLite, workflow runs (step code, retry schedules, cleanup and the agent threads a run starts are excluded; spans an author adds in the workflow body itself are sampled), and spans marked with routineSpan from @t3tools/shared/observability (high-volume lookups and sweeps). A routine span that succeeds in under 10 ms without events is kept only when its own span ID ends in 00 (about one in 256). The key is per span, not per trace or parent, because background fibers share the server's boot trace and recurring ticks reuse one parent span. Counts and averages for these spans in the local file and Settings → Diagnostics are therefore a biased sample. T3CODE_TRACE_MIN_LEVEL=Debug keeps everything. This sampling does not apply to OTLP export.
docker run --name lgtm -p 3000:3000 -p 4317:4317 -p 4318:4318 --rm -ti grafana/otel-lgtmOpen http://localhost:3000 (admin/admin), export OTLP URLs in the shell, and restart the server from that same shell (packaged desktop apps launched from Finder/Dock/Start Menu do not inherit shell env vars):
export T3CODE_OTLP_TRACES_URL=http://localhost:4318/v1/traces
export T3CODE_OTLP_METRICS_URL=http://localhost:4318/v1/metrics
export T3CODE_OTLP_LOGS_URL=http://localhost:4318/v1/logs
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=development
vp run dev- Endpoints:
T3CODE_OTLP_{TRACES,METRICS,LOGS}_URLoutrank standardOTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_ENDPOINTandOTEL_EXPORTER_OTLP_ENDPOINT.T3CODE_OTLP_HEADERS/T3CODE_OTLP_PROTOCOL(http/jsondefault) apply only toT3CODE_OTLP_*endpoints;OTEL_EXPORTER_OTLP_*endpoints readOTEL_EXPORTER_OTLP_*headers/protocol (http/protobufdefault). See user telemetry for Settings precedence. - Service names are fixed:
t3code-server(backend),t3code-desktop(Electron main, traces/logs only), andt3code-web(UI).OTEL_SERVICE_NAMEis ignored—distinguish installs withOTEL_RESOURCE_ATTRIBUTES(e.g.deployment.environment.name=staging). - Kill switches:
T3CODE_OTEL_SDK_DISABLED(outranksOTEL_SDK_DISABLED, accepts standard boolean spellings;OTEL_SDK_DISABLEDonly acceptstrue) disables all OTLP export in server and desktop while keeping local traces and stdout intact.OTEL_{TRACES,METRICS,LOGS}_EXPORTER=nonedisables a single signal unless overridden byT3CODE_OTLP_*_URL. - Trace tuning:
T3CODE_TRACE_FILE,T3CODE_TRACE_MAX_BYTES,T3CODE_TRACE_MAX_FILES,T3CODE_TRACE_MIN_LEVEL,T3CODE_TRACE_TIMING_ENABLED. - Instrumentation rules: Trace operation boundaries via
Effect.fn("Service.operation")(see Effect services). Put high-cardinality IDs/paths on span attributes, never on metric labels.
On macOS and Linux (not Windows), send SIGUSR2 to the server PID from server-runtime.json (in the server's state dir beside logs/) to write <logsDir>/server-<pid>-<timestamp>.heapsnapshot for Chrome DevTools Memory tab:
pid="$(jq .pid "${T3CODE_HOME:-$HOME/.t3}/userdata/server-runtime.json")"
ps -p "$pid" -o command= # verify it is the T3 server—never signal desktop or launcher
kill -USR2 "$pid"- Writing pauses the server (up to a minute+ on large heaps) and needs roughly as much free RAM as the heap—send once, and avoid on a swapping host.
- Snapshots contain tokens, secrets, and thread content. Never share them publicly, and delete them manually when finished.