管理

OpenTelemetry Collectorのデプロイメントを大規模に管理する方法

このドキュメントでは、OpenTelemetry コレクターのデプロイを大規模に管理する方法について説明します。

このページを最大限に活用するには、コレクターのインストールと設定方法を知っている必要があります。 これらのトピックは、別の場所でカバーされています。

  • クイックスタート は OpenTelemetry コレクターのインストール方法を説明します。
  • 設定 では、OpenTelemetry コレクターの設定方法、テレメトリーパイプラインの設定方法を説明します。

基礎

大規模なテレメトリー収集には、エージェントを管理するための構造的なアプローチが必要です。 典型的なエージェント管理タスクは以下の通りです。

  1. エージェント情報と設定の照会。エージェント情報には、バージョン、オペレーティングシステム関連情報、または機能が含まれます。 エージェントの設定は、OpenTelemetry コレクターの設定などのテレメトリー収集のセットアップを指します。
  2. エージェントのアップグレードやダウングレードと、基本的なエージェント機能とプラグインを含むエージェント固有のパッケージの管理。
  3. エージェントへの新しい設定の適用。これは、環境の変化やポリシーの変更により必要になる場合があります。
  4. エージェントのヘルスとパフォーマンスの監視。通常、CPU とメモリの使用量、またエージェント固有のメトリクス(たとえば、処理速度やバックプレッシャー関連情報)。
  5. TLS証明書の処理(失効とローテーション)のような、コントロールプレーンとエージェント間の接続管理。

すべてのユースケースが、上記のエージェント管理タスクのすべてのサポートを必要とするわけではありません。 OpenTelemetryのコンテキストでは、タスク 4.ヘルスとパフォーマンスの監視 は、OpenTelemetryを使うのが理想的です。

OpAMP

オブザーバビリティベンダーやクラウドプロバイダーは、エージェント管理に独自のソリューションを提供しています。 オープンソースのオブザーバビリティの領域では、エージェント管理に使用できる新しい標準があります。 Open Agent Management Protocol (OpAMP)です。

OpAMPの仕様では、テレメトリーデータエージェントのフリート管理方法を定義しています。 これらのエージェントは、OpenTelemetry コレクター、Fluent Bit、または他のエージェントを任意の組み合わせで使用できます。

注意 「エージェント」という用語は、ここではOpAMPに応答するOpenTelemetryコンポーネントの総称として使われています。 つまりコレクターはもちろん、SDKコンポーネントでもありえます。

OpAMPは、HTTPとWebSocketでの通信をサポートするクライアント/サーバープロトコルです。

  • OpAMPサーバはコントロールプレーンの一部であり、オーケストレータとして機能し、テレメトリーエージェントのフリートを管理します。
  • OpAMPクライアントはデータプレーンの一部です。 OpAMPのクライアント側は、たとえばOpenTelemetry コレクターにおけるOpAMPサポートのように、インプロセスで実装できます。 OpAMPのクライアント側は、アウトオブプロセスで実装することもできます。 この場合、OpAMPサーバとのOpAMP固有の通信を行い、同時にテレメトリーエージェントを制御するスーパーバイザーを使用できます。 スーパーバイザーやテレメトリー通信はOpAMPの一部ではないことに注意してください。

具体的な設定を見てみましょう。

OpAMPのセットアップ例
  1. OpenTelemetry コレクターが、次のようなパイプラインで構成されているとする
    • (A) ダウンストリームのソースからシグナルを受信する
    • (B) シグナルをアップストリームの宛先にエクスポートする。ここではコレクター自体のテレメトリーを含む可能性がある。(OpAMP own_xxx 接続設定で表されます)。
  2. サーバ側のOpAMPパートを実装するコントロールプレーンと、クライアント側のOpAMPを実装するコレクター(またはコレクターを制御するスーパーバイザー)の間の双方向のOpAMP制御フロー。

試してみてください

GoによるOpAMPプロトコル実装を使えば、簡単なOpAMPセットアップを自分で試すことができます。 以下のチュートリアルでは、Go 1.22以上が必要です。

OpAMPサーバの例で構成されるシンプルなOpAMPコントロールプレーンをセットアップし、OpenTelemetryコレクターをOpAMPスーパーバイザーを使って接続させます。

ステップ1 - OpAMPサーバーの起動

open-telemetry/opamp-go リポジトリをクローンします。

git clone https://github.com/open-telemetry/opamp-go.git

./opamp-go/internal/examples/server ディレクトリで、OpAMPサーバーを起動します。

$ go run .
2025/04/20 15:10:35.307207 [MAIN] OpAMP Server starting...
2025/04/20 15:10:35.308201 [MAIN] OpAMP Server running...

ステップ 2 - OpenTelemetry コレクターのインストール

OpAMPスーパーバイザーが管理できるOpenTelemetryコレクターのバイナリが必要です。 そのために、OpenTelemetry Collector Contribディストーションをインストールします。 コレクターバイナリをインストールしたパスは、以下の設定では $OTEL_COLLECTOR_BINARY として参照されます。

ステップ3 - OpAMPスーパーバイザーのインストール

opampsupervisor バイナリは、OpenTelemetry コレクター cmd/opampsupervisor タグが付いたリリースからダウンロード可能なアセットとして入手できます。 OSとチップセットに基づいて命名されたアセットのリストがありますので、あなたの構成に合うものをダウンロードしてください。

curl --proto '=https' --tlsv1.2 -fL -o opampsupervisor \
"https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2Fv0.129.0/opampsupervisor_0.129.0_linux_amd64"
chmod +x opampsupervisor
curl --proto '=https' --tlsv1.2 -fL -o opampsupervisor \
"https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2Fv0.129.0/opampsupervisor_0.129.0_linux_arm64"
chmod +x opampsupervisor
curl --proto '=https' --tlsv1.2 -fL -o opampsupervisor \
"https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2Fv0.129.0/opampsupervisor_0.129.0_linux_ppc64le"
chmod +x opampsupervisor
curl --proto '=https' --tlsv1.2 -fL -o opampsupervisor \
"https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2Fv0.129.0/opampsupervisor_0.129.0_darwin_amd64"
chmod +x opampsupervisor
curl --proto '=https' --tlsv1.2 -fL -o opampsupervisor \
"https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2Fv0.129.0/opampsupervisor_0.129.0_darwin_arm64"
chmod +x opampsupervisor
Invoke-WebRequest -Uri "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fopampsupervisor%2Fv0.129.0/opampsupervisor_0.129.0_windows_amd64.exe" -OutFile "opampsupervisor.exe"
Unblock-File -Path "opampsupervisor.exe"

ステップ4 - OpAMPスーパーバイザーの設定ファイルの作成

以下の内容で supervisor.yaml という名前のファイルを作成します。

server:
  endpoint: wss://127.0.0.1:4320/v1/opamp
  tls:
    insecure_skip_verify: true

capabilities:
  accepts_remote_config: true
  reports_effective_config: true
  reports_own_metrics: false
  reports_own_logs: true
  reports_own_traces: false
  reports_health: true
  reports_remote_config: true

agent:
  executable: $OTEL_COLLECTOR_BINARY

storage:
  directory: ./storage

ステップ5 - OpAMPスーパーバイザーの実行

さて、いよいよスーパーバイザーを起動し、OpenTelemetry コレクターを起動します。

$ ./opampsupervisor --config=./supervisor.yaml
{"level":"info","ts":1745154644.746028,"logger":"supervisor","caller":"supervisor/supervisor.go:340","msg":"Supervisor starting","id":"01965352-9958-72da-905c-e40329c32c64"}
{"level":"info","ts":1745154644.74608,"logger":"supervisor","caller":"supervisor/supervisor.go:1086","msg":"No last received remote config found"}

すべてがうまくいっていれば、http://localhost:4321/にアクセスし、OpAMPサーバのUIにアクセスできるはずです。 スーパーバイザーが管理するエージェントの中に、あなたのコレクターが表示されているはずです。

OpAMPの設定例

ステップ 6 - OpenTelemetry コレクターをリモートで設定する

サーバーUIでコレクターをクリックし、Additional Configuration ボックスに以下の内容を貼り付けます。

receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      cpu:

exporters:
  # NOTE: Prior to v0.86.0 use `logging` instead of `debug`.
  debug:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      exporters: [debug]

Save and Send to Agent をクリックします。

OpAMP追加設定

ページをリロードし、エージェントのステータスがUp: trueを表示していることを確認します。

OpAMPエージェント

コレクターに、エクスポートされたメトリクスを照会できます(ラベル値に注意してください)。

$ curl localhost:8888/metrics
# HELP otelcol_exporter_send_failed_metric_points Number of metric points in failed attempts to send to destination. [alpha]
# TYPE otelcol_exporter_send_failed_metric_points counter
otelcol_exporter_send_failed_metric_points{exporter="debug",service_instance_id="01965352-9958-72da-905c-e40329c32c64",service_name="otelcol-contrib",service_version="0.124.1"} 0
# HELP otelcol_exporter_sent_metric_points Number of metric points successfully sent to destination. [alpha]
# TYPE otelcol_exporter_sent_metric_points counter
otelcol_exporter_sent_metric_points{exporter="debug",service_instance_id="01965352-9958-72da-905c-e40329c32c64",service_name="otelcol-contrib",service_version="0.124.1"} 132
# HELP otelcol_process_cpu_seconds Total CPU user and system time in seconds [alpha]
# TYPE otelcol_process_cpu_seconds counter
otelcol_process_cpu_seconds{service_instance_id="01965352-9958-72da-905c-e40329c32c64",service_name="otelcol-contrib",service_version="0.124.1"} 0.127965
...

コレクターのログを調べることもできます。

$ cat ./storage/agent.log
{"level":"info","ts":"2025-04-20T15:11:12.996+0200","caller":"service@v0.124.0/service.go:199","msg":"Setting up own telemetry..."}
{"level":"info","ts":"2025-04-20T15:11:12.996+0200","caller":"builders/builders.go:26","msg":"Development component. May change in the future."}
{"level":"info","ts":"2025-04-20T15:11:12.997+0200","caller":"service@v0.124.0/service.go:266","msg":"Starting otelcol-contrib...","Version":"0.124.1","NumCPU":11}
{"level":"info","ts":"2025-04-20T15:11:12.997+0200","caller":"extensions/extensions.go:41","msg":"Starting extensions..."}
{"level":"info","ts":"2025-04-20T15:11:12.997+0200","caller":"extensions/extensions.go:45","msg":"Extension is starting..."}
{"level":"info","ts":"2025-04-20T15:11:13.022+0200","caller":"extensions/extensions.go:62","msg":"Extension started."}
{"level":"info","ts":"2025-04-20T15:11:13.022+0200","caller":"extensions/extensions.go:45","msg":"Extension is starting..."}
{"level":"info","ts":"2025-04-20T15:11:13.022+0200","caller":"healthcheckextension@v0.124.1/healthcheckextension.go:32","msg":"Starting health_check extension","config":{"Endpoint":"localhost:58760","TLSSetting":null,"CORS":null,"Auth":null,"MaxRequestBodySize":0,"IncludeMetadata":false,"ResponseHeaders":null,"CompressionAlgorithms":null,"ReadTimeout":0,"ReadHeaderTimeout":0,"WriteTimeout":0,"IdleTimeout":0,"Path":"/","ResponseBody":null,"CheckCollectorPipeline":{"Enabled":false,"Interval":"5m","ExporterFailureThreshold":5}}}
{"level":"info","ts":"2025-04-20T15:11:13.022+0200","caller":"extensions/extensions.go:62","msg":"Extension started."}
{"level":"info","ts":"2025-04-20T15:11:13.024+0200","caller":"healthcheck/handler.go:132","msg":"Health Check state change","status":"ready"}
{"level":"info","ts":"2025-04-20T15:11:13.024+0200","caller":"service@v0.124.0/service.go:289","msg":"Everything is ready. Begin running and processing data."}
{"level":"info","ts":"2025-04-20T15:11:14.025+0200","msg":"Metrics","resource metrics":1,"metrics":1,"data points":44}

その他の情報


最終更新 July 9, 2025: fix format (b9c706c0)