Install the Collector with Docker

Ви переглядаєте англійську версію сторінки, тому що її ще не було повністю перекладеною українською. Бажаєте допомогти? Дивіться як взяти Участь.

PS. Неофіційний український переклад (не перевірений і не ухвалений OpenTelemetry) доступний на сайті члена спільноти, створеному на основі PR #5891. Ми надаємо це посилання як тимчасовий захід підтримки українських читачів та потенційних учасників, доки не буде готовий офіційний переклад.

The following commands pull a Docker image and run the Collector in a container. Replace 0.147.0 with the version of the Collector you want to run.

docker pull otel/opentelemetry-collector:0.147.0
docker run otel/opentelemetry-collector:0.147.0
docker pull ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.147.0
docker run ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.147.0

To load a custom configuration file from your working directory, mount the file as a volume:

docker run -v $(pwd)/config.yaml:/etc/otelcol/config.yaml otel/opentelemetry-collector:0.147.0
docker run -v $(pwd)/config.yaml:/etc/otelcol/config.yaml ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.147.0

Docker Compose

You can also add the OpenTelemetry Collector to your existing docker-compose.yaml file:

otel-collector:
  image: otel/opentelemetry-collector
  volumes:
    - ./otel-collector-config.yaml:/etc/otelcol/config.yaml
  ports:
    - 1888:1888 # pprof extension
    - 8888:8888 # Prometheus metrics exposed by the Collector
    - 8889:8889 # Prometheus exporter metrics
    - 13133:13133 # health_check extension
    - 4317:4317 # OTLP gRPC receiver
    - 4318:4318 # OTLP http receiver
    - 55679:55679 # zpages extension

The otel-collector-config.yaml file is required for the Collector to start. For more information, see Collector configuration.

Below is a minimal Collector configuration that logs all received telemetry.

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [debug]
    metrics:
      receivers: [otlp]
      exporters: [debug]
    logs:
      receivers: [otlp]
      exporters: [debug]