> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenTelemetry Collector

> Configure the Operator-managed Collector to record and forward Big Peer telemetry.

The Operator-managed `BigPeerOtelCollector` can record Big Peer metrics and receive OTLP/HTTP metrics and logs. It can also forward telemetry to an OpenTelemetry-compatible backend.

`BigPeerOtelCollector` is available in Ditto Operator `1.0.0-experimental.1` and later. Install that chart version or a later version that includes the resource and its telemetry features before applying the examples below.

## Record telemetry

Create a `BigPeerOtelCollector` in the Big Peer's namespace. This example keeps the ten most recent archives on a 5 Gi volume and requires a default StorageClass:

```yaml theme={null}
apiVersion: ditto.live/v1alpha1
kind: BigPeerOtelCollector
metadata:
  name: telemetry
  namespace: ditto
spec:
  flightRecorder:
    interval: 5m
    maxArchives: 10
    storage:
      provisioned:
        size: 5Gi
```

Apply the resource and wait for it to become ready:

```bash theme={null}
kubectl apply -f telemetry.yaml
kubectl -n ditto wait bigpeerotelcollector/telemetry --for=condition=Ready --timeout=5m
kubectl -n ditto get bigpeerotelcollector telemetry -o yaml
```

The Collector accepts OTLP/HTTP on port `4318`, with metrics at `/v1/metrics` and logs at `/v1/logs`. To accept OTLP requests from outside the cluster, configure `spec.network.telemetry: {}` on the Big Peer. The Operator routes this endpoint when there is one eligible recording Collector in the namespace. Check the Big Peer's `TelemetryIngest` condition if the route is unavailable.

Archives contain the original telemetry payloads and are not redacted. Review archives before sharing them. Disabling recording retains its provisioned volume until the Collector resource is deleted.

## Forward telemetry

To forward metrics and logs to an OTLP/HTTP backend, provide a Collector configuration in a ConfigMap. Replace the endpoint with your backend URL:

```yaml theme={null}
apiVersion: v1
kind: ConfigMap
metadata:
  name: telemetry-forwarding
  namespace: ditto
data:
  collector.yaml: |
    exporters:
      otlphttp/backend:
        endpoint: https://telemetry.example.com
        headers:
          Authorization: Bearer ${env:BACKEND_TOKEN}
    service:
      pipelines:
        metrics/backend:
          receivers: [prometheus/flight-recorder, otlp]
          exporters: [otlphttp/backend]
        logs/backend:
          receivers: [otlp]
          exporters: [otlphttp/backend]
```

Enter the backend token at a hidden prompt and save it to a local file with owner-only permissions. Keep this file out of source control:

```bash theme={null}
umask 077
python3 -c 'import getpass, pathlib; pathlib.Path("backend-token").write_text(getpass.getpass("Backend token: "))'
chmod 600 ./backend-token
```

Create the Secret from that file. Save the ConfigMap shown above as `telemetry-forwarding.yaml`, then apply it:

```bash theme={null}
kubectl -n ditto create secret generic telemetry-forwarding-credentials \
  --from-file=token=./backend-token
kubectl apply -f telemetry-forwarding.yaml
```

Add an `overlay` alongside `flightRecorder` under `spec` in the Collector resource. The `env` mapping makes the Secret value available to the Collector as `BACKEND_TOKEN`:

```yaml theme={null}
spec:
  flightRecorder:
    interval: 5m
    maxArchives: 10
    storage:
      provisioned:
        size: 5Gi
  overlay:
    configMap:
      name: telemetry-forwarding
    env:
      BACKEND_TOKEN:
        name: telemetry-forwarding-credentials
        key: token
```

Save the updated Collector manifest as `telemetry.yaml`, then apply it:

```bash theme={null}
kubectl apply -f telemetry.yaml
```

The Operator validates a configuration before activating it and keeps the last accepted configuration if a replacement is invalid. Check the Collector's conditions with `kubectl -n ditto get bigpeerotelcollector telemetry -o yaml`.


## Related topics

- [Tracing Document Propagation](https://docs.ditto.live/sdk/latest/sync/tracing-document-propagation.md)
- [Release Notes](https://docs.ditto.live/sdk/latest/release-notes-hub/kotlin.md)
- [DittoConfig](https://docs.ditto.live/sdk/v4/ditto-config.md)
