<!-- OpenTelemetry Collector — Heystack docs. Rendered: https://heystack.dev/docs/collector · Index: https://heystack.dev/llms.txt -->
# OpenTelemetry Collector

If you already run an [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) — or you have non-JavaScript services (Go, Python, Java, Ruby, etc.) that already emit OTLP — you can route telemetry straight to Heystack without installing the SDK. Everything lands in the same explorer as SDK-instrumented apps.

Good fits for this approach:
- You have an existing Collector (e.g. running as a sidecar or on a dedicated host) and want to add Heystack as a second export destination.
- Your services are already instrumented with OpenTelemetry and export OTLP.
- You want to aggregate telemetry from several services or languages in one place before forwarding.

## Ingest endpoints

Heystack's ingest worker listens at `https://ingest.heystack.dev`:

| Signal  | Path          |
|---------|---------------|
| Traces  | `/v1/traces`  |
| Logs    | `/v1/logs`    |
| Metrics | `/v1/metrics` |

These are standard OTLP/HTTP endpoints. The Collector's `otlphttp` exporter appends the signal path automatically when you set `endpoint`.

## Authentication

Use an ingest key from the Heystack console (**Settings → Connection & keys**). Pass it as a Bearer token:

```
Authorization: Bearer sk_live_your_key_here
```

The same key works for all three signals.

## Collector configuration

Add `otlphttp/heystack` as an exporter in your `config.yaml`:

```yaml
exporters:
  otlphttp/heystack:
    endpoint: https://ingest.heystack.dev
    encoding: proto         # or json; both are accepted
    compression: gzip       # or none; both are accepted
    headers:
      Authorization: "Bearer sk_live_your_key_here"

service:
  pipelines:
    traces:
      exporters: [otlphttp/heystack]
    logs:
      exporters: [otlphttp/heystack]
    metrics:
      exporters: [otlphttp/heystack]
```

If you already export to another backend, add `otlphttp/heystack` alongside your existing exporter:

```yaml
service:
  pipelines:
    traces:
      exporters: [otlphttp/your-existing-backend, otlphttp/heystack]
```

## Batch sizing

Keep batches within these limits to avoid a `413` response:

- **Body size**: 5 MB per request, both on the wire and after gzip decompression. Heystack stops reading a streamed request as soon as it crosses the limit.
- **Row count**: 10,000 total rows per request: spans plus their events and links, log records, or metric data points. The count is checked before the request is processed, so an over-limit batch is rejected quickly. Rows Heystack derives from the batch count too: each product event, user identification and AI rating record adds a row of its own, as does each request that matches a key event. A batch made mostly of those records reaches the limit at about 5,000 records, so keep such batches below that.
- **Values per request**: about 250,000 individual values (attributes, events and similar) for protobuf, or 500,000 JSON objects and arrays for JSON. Normal batches are far below this.
- **Individual row size**: 95 KB after processing. A larger individual row cannot be queued and receives `413` without retrying.

### Timestamps

Heystack keeps 30 days of data. Each record's timestamp is checked when it arrives:

- **More than 1 hour in the future**: the record is dropped. This usually means a device clock is wrong, and accepting it would make a record look like your newest activity or release.
- **Older than 30 days, or missing**: the record is kept with its timestamp set to the 30-day limit. It is removed with the rest of your 30-day-old data.

URLs in span and log attributes (`url.full`, `http.url`, `http.target`, `url.original`, `url.query`, `url.fragment`) are cleaned before they are stored. This happens even when the data didn't come from the Heystack SDK, for example spans from Cloudflare's built-in tracing or another collector. A `user:password@` prefix is removed, and the values of parameters that usually carry secrets (`key`, `token`, `code`, `access_token`, `signature`, and similar) become `REDACTED`.

The default `batch` processor settings work well in practice. If you see 413 errors, reduce `send_batch_size` or `send_batch_max_size` in your batch processor config.

## Limitations

- **JSON and protobuf are supported** — use OTLP/HTTP with `application/json` or `application/x-protobuf`.
- **Gzip is supported** — compressed requests are accepted as long as both the compressed and decompressed bodies remain within the 5 MB limit.
- **Ingest keys are app-scoped** — each key is tied to one Heystack app. If you aggregate telemetry from multiple apps through one Collector pipeline, either use separate pipelines with separate keys, or create a single Heystack app to represent the aggregate.
