Prometheusレシーバー
Prometheus レシーバーにより、Splunk Distribution of OpenTelemetry Collector は Prometheus フォーマットと互換性のあるスクレイピングソースからメトリクスを収集することができます。
Prometheus レシーバーにより、Splunk Distribution of OpenTelemetry Collector は、Prometheus 形式でテレメトリを公開するあらゆるソースからメトリクスを収集できるようになります。サポートされているパイプラインのタイプは metrics です。詳細については「パイプラインでデータを処理する」を参照してください。
シングルエンドポイントをサポートする Prometheus レシーバーの簡易版を使用するには、「Simple Prometheus receiver」を参照してください。
メリット
Prometheus レシーバーは、Prometheus エンドポイントを公開する任意のアプリケーションからメトリクスデータを取得できます。レシーバーは、メトリクス名、値、タイムスタンプ、ラベルを保持しながら、Prometheus メトリクスを OpenTelemetry メトリクスに変換します。既存の Prometheus 設定を再利用することもできます。
Prometheus と互換性のあるサードパーティ製アプリケーションの全リストは、https://prometheus.io/docs/instrumenting/exporters/ で Prometheus の公式ドキュメントを参照してください。
はじめに
以下の手順に従って、コンポーネントの設定とアクティベーションを行ってください:
-
Splunk Distribution of the OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:
-
次のセクションで説明するようにレシーバーを設定します。
-
Collector を再起動します。
サンプル構成
デフォルトでは、Splunk Distribution of OpenTelemetry Collectorには、metrics/internal パイプラインにPrometheusレシーバーが含まれています。
追加の Prometheus レシーバーをアクティブにするには、次の例のように Collector 設定ファイルの receivers セクションに新しい prometheus エントリーを追加します:
receivers:
prometheus:
config:
scrape_configs:
- job_name: 'sample-name'
scrape_interval: 5s
static_configs:
- targets: ['0.0.0.0:8888']
設定を完了するには、構成ファイルの service セクションの metrics パイプラインにレシーバーを含めます。例:
service:
pipelines:
metrics:
receivers:
- prometheus
prometheus/internal レシーバーを削除しないでください。内部メトリクスは Splunk Distribution of OpenTelemetry Collector のデフォルトダッシュボードにフィードされます。スクレーパーの構成
Prometheus レシーバーは、config.scrape_configs セクションを通じて、サービス検出を含む Prometheus のほとんどの取得構成をサポートします。構成ファイルの scrape_config セクションでは、一連のターゲットとそれらの取得方法を記述するパラメータを指定できます。
基本設定では、シングルスクレイプ設定は 1 つのジョブを指定します。static_configs パラメータを使用して、静的ターゲットを設定できます。動的に検出されたターゲットは、Prometheus のサービス検出メカニズムを使用します。さらに、relabel_configs パラメータを使用すると、スクレイプする前にターゲットとそのラベルを詳細に変更できます。
以下は基本的なスクレイプ設定の例です:
receivers:
prometheus:
config:
scrape_configs:
# The job name assigned to scraped metrics by default.
# <job_name> must be unique across all scrape configurations.
- job_name: 'otel-collector'
# How frequently to scrape targets from this job.
# The acceptable values are <duration> | default = <global_config.scrape_interval> ]
scrape_interval: 5s
# List of labeled statically configured targets for this job.
static_configs:
- targets: ['0.0.0.0:8888']
- job_name: k8s
# Scraping configuration for Kubernetes
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
regex: "true"
action: keep
# List of metric relabel configurations.
metric_relabel_configs:
- source_labels: [__name__]
regex: "(request_duration_seconds.*|response_duration_seconds.*)"
action: keep
Prometheus レシーバー設定で環境変数を使用するには、${<var>} シンタックスを使用します。例:
prometheus:
config:
scrape_configs:
- job_name: ${JOBNAME}
scrape_interval: 5s
既存の Prometheus 設定を使用している場合は、$ を $$ に置き換えて、Collector が環境変数として読み込まないようにしてください。
スケーリングに関する考慮事項
同じ設定で Collector の複数のレプリカを実行すると、Prometheus レシーバーはターゲットを複数回取得します。異なるスクレイピング設定で各レプリカを設定する必要がある場合、スクレイピングをシャードします。Prometheus レシーバーはステートフルです。スケーリングの考慮事項については、「サイジングとスケーリング」を参照してください。
既知の制限
以下の Prometheus 機能はサポートされておらず、レシーバー設定で使用するとエラーを返します:
-
alert_config.alertmanagers -
alert_config.relabel_configs -
remote_read -
remote_write -
rule_files
設定
以下の表は、Prometheusレシーバーの設定オプションを示しています:
同梱
https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/receiver/prometheus.yaml
メトリクス
Prometheus レシーバーは、以下の変換ルールに従って Prometheus メトリクスを OpenTelemetry メトリクスに変換します:
|
Prometheusのメトリクスタイプ |
OpenTelemetryのメトリクスタイプ |
|---|---|
|
カウンター(単調) |
合計 (データ型 |
|
不明 |
ゲージ (データ型 |
|
ヒストグラム |
ヒストグラム(累積分布) |
|
概要 |
サマリー(パーセンタイル) |
ヒストグラムのサポート
ヒストグラムのサポートの詳細については、「Send histogram metrics in OTLP format」を参照してください。
トラブルシューティング
__ ___ ___ _ ______ _____________ _____ ________ ___ ___ ___ ____ __ ___ ____ ____ __ ______ _____________ ______ ___ ___ ___ ____ __ ___ _________ _____
_________ __ ______ _____________ _____ _________
-
______ _ ____ __ ___ ______ _______ _______
-
_______ ______ ________
_________ __ ___________ _________ ___ ____ _____ _____
-
___ _ ________ ___ ___ _______ _______ _________ _______ __ ______ ________
-
____ ___ ______ ______________ ____ _____ _____ _______ __ ___________ ____ __________ _________ ___ ______ _________ __________ __ _____ ___ ____ _______