Skip to main content

Components

  • ldev: runs the services, stores telemetry in memory, serves the UI and the API.
  • localdevcollector: an OpenTelemetry Collector built for Localdev. Receives telemetry from the services and forwards it to Localdev.
  • Guard process: a second copy of ldev that stops the services if Localdev dies.

Data flow

The collector pipeline for logs, metrics and traces: OTLP receiver → batch processor → OTLP exporter to Localdev.

Ports

All ports are on localhost. To run two instances of Localdev at once, change all four (see Two instances at once).

Start-up order

  1. Read and validate the Projectfile. Any error stops here.
  2. Allocate the store.
  3. Bind ports 50000 and 2345 (-collector-address, -server).
  4. Start the guard process.
  5. Check that 4998 and 4999 (collector.receivers) are free, then start the collector.
  6. Start all services.
Services start together. There is no start order, depends_on or health check.

Running services

  • Working directory: the directory of the Projectfile.
  • Each service gets its own process group, so Localdev can stop everything it spawned (npm, go run, shells).
  • Environment: see Environment variables.
  • stdout and stderr go straight to files.
  • A service that exits stays down. There is no automatic restart. Restart it from the UI.
  • A service that exits on its own shows as Crashed, with the reason (exit status 3, signal: killed). Its Output opens on stderr, where a panic or stack trace usually is.

Files

Localdev writes nothing into your project, except when you save changes from the environment editor to the Projectfile. Everything else goes to the system’s temporary directory ($TMPDIR; on macOS, under /var/folders/…):
  • Each run of ldev gets a new directory. Localdev prints it at start-up as Service output:.
  • Only your user can read the files.
  • A restarted service appends to its existing files.
  • The files aren’t deleted when Localdev exits. Delete old directories yourself if they pile up.
The UI shows the end of each service’s output under Project → Services → Output.

Stopping

  • Ctrl-C or SIGTERM: every service’s process group gets SIGTERM.
  • After 5 seconds, whatever is left gets SIGKILL.
  • A second Ctrl-C kills immediately.
  • The collector stops last, so telemetry flushed during shutdown still arrives.

If Localdev is killed

Localdev holds a pipe to the guard. The kernel closes it no matter how Localdev dies (SIGKILL, crash, panic). The guard then sends SIGTERM to every process group, and SIGKILL after 5 seconds.

Storage

Telemetry is kept in memory only, and is gone when Localdev stops.
  • It’s held in three fixed-size ring buffers: logs, metric points and trace spans.
  • When a buffer is full, new records overwrite the oldest.
  • A trace is dropped whole when its oldest span is overwritten, so traces never show random gaps. A link to a dropped trace shows “This trace has been dropped to make room for newer traces”. If that happens often, raise store.trace_spans.
The defaults hold, for example:
  • A 10-hour day of metrics for about 275 series exported every 10 seconds, or about 1,650 series at the SDKs’ default of 60 seconds.
  • 5,000 requests of 10 spans each.
To change the sizes, use store in the Projectfile, or the flags and variables in the CLI reference.