Сервис приложения
Сервисы/OpenTelemetry Collector

Сервис OpenTelemetry Collector

OpenTelemetry Collector принимает телеметрию OTLP и передаёт трассировки, логи и метрики в связанные сервисы Tempo, Loki и VictoriaMetrics.

Вы добавляете этот сервис в стек и выбираете там его версию и ресурсы. Каждое окружение может их переопределить.

В StackMaster

Как OpenTelemetry Collector работает в StackMaster

What Wodby sets up for the OpenTelemetry Collector on this service. It runs the official contrib distribution, 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 port 4317, 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: override upstream for one signal. traces also accepts Grafana Tempo, metrics VictoriaMetrics, and logs Grafana 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) and batch.
  • Exporters: otlp_http/traces, otlp_http/metrics and otlp_http/logs, each with the address and Authorization header its link sets, and nop for signals without a destination. The pipelines read their exporter lists from OTLP_<SIGNAL>_EXPORTERS.
  • The health_check extension answers on port 13133; 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/vendor with the vendor's endpoint and headers, 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_sampling or probabilistic_sampler processor before batch. 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/traces returns 200.

Обзор

Технический профиль OpenTelemetry Collector

Здесь перечислены версии, которые можно выбрать для OpenTelemetry Collector в стеке или окружении. Сам сервис публикуется ревизиями, и стек ссылается на конкретную ревизию.

Тип сервиса

Сервис приложения

Версии

0

Стеки

Стеки, в которые входит OpenTelemetry Collector

OpenTelemetry Collector входит в эти публичные стеки. Можно создать приложение из публичного стека как есть или добавить сервис в собственный стек.

Конфигурация

Конфигурация сервиса OpenTelemetry Collector

Сервис OpenTelemetry Collector объявляет следующее. Если значение можно изменить, его задаёт стек, а каждое окружение может его переопределить.

Технические домены

StackMaster выдаёт каждому публичному HTTP-порту технический домен с TLS-сертификатом и продлевает сертификат. Порт, который сервис помечает как частный, домен не получает. Можно добавить собственные домены.

Файлы конфигурации

1 файл конфигурации, который стек или окружение могут переопределить.

Связи сервиса

Каждая связь — это подключение OpenTelemetry Collector к другому сервису. На какой сервис указывает связь, задаёт стек. На карточках перечислены публичные сервисы, которые подходят для каждой связи.