TestCollectorFanout in tests/otelapps, which runs the configuration below on the stock
otel/opentelemetry-collector-contrib 0.165.0 image and checks that metrics and traces arrive at
both a tenant backend and a platform stand-in that refuses requests without the token.
The configuration
Fromexamples/otel-collector-fanout/collector.yaml:
Every component used here (
otlp receiver, memory_limiter, batch, otlphttp exporter) is
part of the core and contrib distributions.
Adding it to an existing configuration
You probably have receivers, processors and an exporter already. Only two things are new:- the
otlphttp/platformexporter with theAuthorizationheader, and - that exporter added to the
metricsandtracespipelines.
logs pipeline: the platform accepts logs and discards them, so sending them
only costs bandwidth.
Things to keep in mind
- One token per Collector is enough: the token identifies your project, and
service.namefrom each app’s resource tells the services apart. - Do not filter or rename the HTTP duration metrics or their
http.*attributes on the way to the platform; it needshttp.server.request.duration(orhttp.server.duration) with the method, route and status code (what-gets-dropped.md). - Do not aggregate across apps before export (for example with a processor that merges
services): the platform keeps
service.nameas a dimension. - Sampling. If your Collector samples traces (tail sampling) and your apps send no metrics, the platform derives request counts from the sampled spans and undercounts. Export metrics, or send the platform copy from a pipeline before sampling.
- Retries. The platform answers 429 when a project exceeds its rate limit and 502 or 503 during short outages; the exporter’s retry and queue settings above handle both.