# car-telemetry

Tracing and OpenTelemetry initialization for [Common Agent Runtime](https://github.com/Parslee-ai/car).

## What it does

Provides a layered `tracing` subscriber:

- **`fmt` layer** — human-readable stderr output (always on)
- **`opentelemetry` layer** — OTLP export, enabled when `OTEL_EXPORTER_OTLP_ENDPOINT` is set

## Usage

```rust,ignore
fn main() -> anyhow::Result<()> {
    car_telemetry::init()?;
    // ... rest of program
    Ok(())
}
```

## Configuration

| Env var | Effect |
|---------|--------|
| `RUST_LOG` | Standard `tracing-subscriber` filter (e.g. `car_engine=debug,info`) |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP collector URL — when set, enables OTLP export layer |
| `OTEL_SERVICE_NAME` | Service name attached to spans (defaults to the binary name) |

## Where it fits

Initialized by `car-server`'s `main` (per the library boundary contract — `car-server-core` does not initialize telemetry itself). Embedders should call `init()` from their own `main`.
