レシーバークリエーターレシーバー
レシーバークリエータを使用して、ルールに基づいて OpenTelemetry Collector で実行時にレシーバーを作成します。コンポーネントの設定方法については、続きをお読みください。
Splunk Distribution of the OpenTelemetry Collector で レシーバー クリエータ レシーバーを使用すると、設定されたルールとオブザーバ拡張に基づいて、実行時に新しいレシーバーを作成できます。サポートされるパイプラインタイプは、metrics、traces、logs です。詳細については「パイプラインでデータを処理する」を参照してください。
レシーバークリエーターのリスナーとして、以下のオブザーバー拡張機能のいずれかを使用できます:
-
docker_observer:Docker APIを通じて実行中のコンテナエンドポイントを検出し、レポートします。 -
ecs_task_observer:ECS タスクを実行するコンテナエンドポイントを検出し、レポートします。 -
host_observer: 現在のホストのリッスンしているネットワークエンドポイントを発見します。 -
k8s_observer: Kubernetes APIを通じてKubernetesのポッド、ポート、ノードのエンドポイントを検出し、レポートします。
このレシーバーは、kubeletstats や hostmetrics レシーバーのように、アプリケーションやホスト用の他のレシーバーを使用できます。レシーバークリエータの典型的なユースケースは、Kubernetes Pod や Docker コンテナなど、動的にデプロイされるインフラストラクチャのメトリクスを収集することです。
はじめに
以下の手順に従って、コンポーネントの設定とアクティベーションを行ってください:
-
Splunk Distribution of the OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:
-
次のセクションで説明するように、レシーバークリエーターレシーバーを設定します。
-
Collector を再起動します。
サンプル構成
レシーバー クリエーター レシーバーを有効にするには、構成ファイルの extensions セクションに必要なエクステンションを追加し、続いて receivers セクションに receiver_creator インスタンスを追加します。例:
extensions:
# Configures the Kubernetes observer to watch for pod start and stop events.
k8s_observer:
auth_type: serviceAccount
# Can be set to the node name to limit discovered endpoints
# The value can be obtained using the downward API
node: ${env:K8S_NODE_NAME}
observe_pods: true
observe_nodes: true
receivers:
receiver_creator/k8skubeletstats:
watch_observers: [k8s_observer]
receivers:
kubeletstats:
# If this rule matches an instance of this receiver will be started.
rule: type == "k8s.node"
config:
auth_type: serviceAccount
collection_interval: 15s
endpoint: '`endpoint`:`kubelet_endpoint_port`'
extra_metadata_labels:
- container.id
metric_groups:
- container
- pod
- node
service:
extensions: [k8s_observer]
pipelines:
metrics:
receivers: [receiver_creator/k8skubeletstats]
receiver_creator 設定の receivers セクション内で、サポートされている任意のレシーバーをネストして設定することができます。どのレシーバーをネストできるかは、watch_observers で定義されているエクステンションを通じてレシーバークリエータが監視しているインフラストラクチャの種類によって異なります。
例:Dockerオブザーバー
以下の例では、Docker observerを使用してレシーバークリエーターレシーバーを設定する方法を示しています:
extensions:
docker_observer:
# Default is unix:///var/run/docker.sock
# Collector must have read access to the Docker Engine API
endpoint: path/to/docker.sock
excluded_images: ['redis', 'another_image_name']
# Docker observer requires Docker API version 1.22 or higher
api_version: 1.42
# Time to wait for a response from Docker API. Default is 5 seconds
timeout: 15s
receivers:
receiver_creator:
watch_observers: [docker_observer]
receivers:
nginx:
rule: type == "container" and name matches "nginx" and port == 80
config:
endpoint: '`endpoint`/status'
collection_interval: 10s
例Kubernetesオブザーバー
次の例では、Kubernetesオブザーバーを使用してレシーバークリエーターレシーバーを設定する方法を示しています:
extensions:
k8s_observer:
auth_type: serviceAccount
# Can be set to the node name to limit discovered endpoints
# The value can be obtained using the downward API
node: ${env:K8S_NODE_NAME}
observe_pods: true
observe_nodes: true
receivers:
receiver_creator:
watch_observers: [k8s_observer]
receivers:
kubeletstats:
rule: type == "k8s.node"
config:
auth_type: serviceAccount
collection_interval: 10s
endpoint: "`endpoint`:`kubelet_endpoint_port`"
extra_metadata_labels:
- container.id
metric_groups:
- container
- pod
- node
新しいレシーバーを作成するためのルール
このレシーバーを使用して、ルールに基づいて新しいレシーバーを動的に作成できます。ルールが 1 つのエンドポイントタイプにのみ一致するように、各ルールは type == ("pod"|"port"|"hostport"|"container"|"k8s.node") && で始まる必要があります。
各エンドポイントタイプで利用可能な変数のリストについては、GitHub の「Rules expressions」を参照してください。
設定
次の表は、レシーバークリエーターレシーバーの設定オプションを示します:
トラブルシューティング
If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.
Available to Splunk Observability Cloud customers
-
Submit a case in the Splunk Support Portal.
-
Contact Splunk Support.
Available to prospective customers and free trial users
-
Ask a question and get answers through community support at Splunk Answers.
-
Join the Splunk community #observability Slack channel to communicate with customers, partners, and Splunk employees worldwide.