Skip to main content
A custom collector replaces the localdevcollector binary with one you build yourself. This page lists what it must contain, and shows how to build and use it. It assumes you know the OpenTelemetry Collector. Localdev still generates the collector’s configuration, so your collector runs the same pipeline as localdevcollector (see Use it in your project).
Adding your own components to that pipeline, for example by passing a second --config in collector.command, hasn’t been tested.

Default configuration for Localdev’s collector

localdevcollector is built with the OpenTelemetry Collector Builder (OCB) 0.165.0 from builder-config.yaml in the Localdev repository. It contains a minimal set of components, shown below, which may not be enough for your needs.
builder-config.yaml

Requirements

Localdev generates the collector’s configuration, so your collector must contain at least these components: Build it with OCB 0.165.0 or newer. The generated configuration uses the otlp_grpc exporter name, which older versions don’t recognise.

Build your own collector

  1. Download OCB for your platform. The release assets are named ocb_<version>_<darwin|linux>_<amd64|arm64>:
  2. Copy the builder-config.yaml above, change dist.name and dist.output_path, and add your components.
  3. Build it:

Use it in your project

Point collector.command in the Projectfile to your collector:
  • Use an absolute path, or a name found on PATH. A relative path is resolved from the directory you run ldev in, not the Projectfile’s directory.
  • Localdev adds --config=<generated file> to your command. Other arguments in command are kept, and are split the same way as a service’s command.
The generated configuration:
  • Receives OTLP gRPC on localhost:4998 and OTLP HTTP on localhost:4999, or on the ports in collector.receivers.
  • Sends traces, metrics and logs through batch and exports them over OTLP gRPC to Localdev (-collector-address, localhost:50000 by default), without TLS.
  • Can’t be replaced from the Projectfile. You can see its path in the UI under Project → Collector.
The collector’s own log is localdevcollector-out.log in Localdev’s temporary directory.