Тип сервиса
Сервис OpenTelemetry Collector
OpenTelemetry Collector принимает телеметрию OTLP и передаёт трассировки, логи и метрики в связанные сервисы Tempo, Loki и VictoriaMetrics.
Вы добавляете этот сервис в стек и выбираете там его версию и ресурсы. Каждое окружение может их переопределить.
В StackMaster
Как OpenTelemetry Collector работает в StackMaster
otel/opentelemetry-collector-contrib, with the configuration file from the config entry mounted at /etc/otelcol-contrib/wodby.yaml. The Collector receives traces, metrics and logs over OTLP and sends each signal to the destination its links name.How applications send traces
Every OTLP request needs the ingest token generated by Wodby (token ingest_token), sent as Authorization: Bearer <token>. Requests without it get 401. The token is in OTLP_INGEST_TOKEN inside this container.
- From another environment or outside Wodby: port
4318(OTLP over HTTP) has a public HTTPS domain. Use the domain without a path; SDKs append/v1/traces. - From a service in the same environment:
http://<Collector service name>:4318, or gRPC on port4317, which is private. A linked service can read the token as{{link.tokens.ingest_token}}.
Configure applications with the standard OpenTelemetry SDK variables, for example:
OTEL_EXPORTER_OTLP_ENDPOINT=https://<Collector domain>
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20<ingest token>
OTEL_SERVICE_NAME=<application name>Store the header variable as a secret. The space after Bearer is written as %20 because SDKs URL-decode header values.
Destinations
Four links decide where data goes. Each can point at a service in this environment, at a Collector in another app (crossApp), or at a custom target whose OTLP endpoint and Authorization header a user enters.
upstream: where every signal goes by default. Accepts another Collector.traces,metrics,logs: overrideupstreamfor one signal.tracesalso accepts Grafana Tempo,metricsVictoriaMetrics, andlogsGrafana Loki.
At least one of the four must be set while the service is enabled (link group destination); otherwise Wodby reports a missing required link instead of starting a Collector with nowhere to send. A signal with no destination is dropped.
Each link reads the target's exports otlp_http_endpoint and otlp_http_authorization and sets OTLP_<SIGNAL>_ENDPOINT, OTLP_<SIGNAL>_AUTHORIZATION (secret) and OTLP_<SIGNAL>_EXPORTERS for TRACES, METRICS and LOGS. A target in another app on the same cluster is reached over the private network, which Wodby opens for the linked environments only; a target on another cluster is reached over its public domain. upstream also sets OTLP_UPSTREAM_ENDPOINT and OTLP_UPSTREAM_AUTHORIZATION for older forwarding configurations.
This service exports the same two values, so other Collectors can link to it, also from other apps.
Forwarding from an application
Wodby app stacks for application runtimes include this service as otel-collector, disabled by default, with port 4318 kept private. The application's otel link sets OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL and OTEL_EXPORTER_OTLP_HEADERS (with the ingest token) while the Collector is enabled. Set its upstream link before enabling it, usually to the Collector of an Observability app or a custom target for a hosted backend.
What is configured
- Receivers: OTLP over gRPC (
4317) and HTTP (4318), both with bearer-token authentication. - Processors:
memory_limiter(refuses data above 80% of the container memory limit) andbatch. - Exporters:
otlp_http/traces,otlp_http/metricsandotlp_http/logs, each with the address and Authorization header its link sets, andnopfor signals without a destination. The pipelines read their exporter lists fromOTLP_<SIGNAL>_EXPORTERS. - The
health_checkextension answers on port13133; Kubernetes probes use it. - The container runs as user
10001, not root. The image has no shell. - The service is scalable: replicas share no state with the default configuration.
Changing configuration
Edit the config entry of the app service, not the file in the container. The Collector reads the file only when it starts: after saving a change, deploy the service. Wodby restarts the pods when the file changed. Keep the bearertokenauth extension on the receivers while port 4318 has a public domain.
The file is processed for Wodby tokens such as {{links.upstream.values.endpoint}}. Write Collector environment references as ${env:NAME}.
Common changes:
- Send a signal to a second backend as well: add an exporter, such as
otlp_http/vendorwith the vendor'sendpointandheaders, and list it in that signal's pipeline in place of${env:OTLP_<SIGNAL>_EXPORTERS:-[nop]}. Put the vendor key in a secret environment variable of the service and reference it with${env:NAME}. - Sampling: add the
tail_samplingorprobabilistic_samplerprocessor beforebatch. Tail sampling needs all spans of a trace on one replica, so keep one replica with it.
Check the result
The image has no shell. From another service in the environment:
curl -s http://<Collector service name>:13133/answers when the Collector is ready.- Send a test request:
curl -s -o /dev/null -w '%{http_code}' -X POST -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' -d '{}' http://<Collector service name>:4318/v1/tracesreturns200.
Обзор
Технический профиль OpenTelemetry Collector
Версии
Репозиторий исходного кода
Публичный Helm-чарт
Стеки
Стеки, в которые входит OpenTelemetry Collector
Конфигурация
Конфигурация сервиса OpenTelemetry Collector
Технические домены
Файлы конфигурации
Связи сервиса
Каждая связь — это подключение OpenTelemetry Collector к другому сервису. На какой сервис указывает связь, задаёт стек. На карточках перечислены публичные сервисы, которые подходят для каждой связи.
upstream
Сервисы, которые подходят для этой связи
traces
Сервисы, которые подходят для этой связи
metrics
Сервисы, которые подходят для этой связи
logs
Сервисы, которые подходят для этой связи