第6章 モニタリングスタックのメトリクスの設定


クラスター管理者は、OpenTelemetry Collector カスタムリソース (CR) を設定して、次のタスクを実行できます。

  • Collector のパイプラインメトリクスと有効な Prometheus エクスポーターをスクレイプするための Prometheus ServiceMonitor CR を作成します。
  • クラスター内モニタリングスタックからメトリクスを取得するように Prometheus Receiver を設定します。

6.1. モニタリングスタックにメトリクスを送信するための設定

次の 2 つのカスタムリソース (CR) のいずれかによって、モニタリングスタックへのメトリクスの送信が設定されます。

  • OpenTelemetry Collector CR
  • Prometheus PodMonitor CR

設定された OpenTelemetry Collector CR は、Collector のパイプラインメトリクスと有効な Prometheus エクスポーターをスクレイプするための Prometheus ServiceMonitor CR を作成できます。

Prometheus エクスポーターを使用した OpenTelemetry Collector CR の例

Copy to Clipboard Toggle word wrap
apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
spec:
  mode: deployment
  observability:
    metrics:
      enableMetrics: true 
1

  config:
    exporters:
      prometheus:
        endpoint: 0.0.0.0:8889
        resource_to_telemetry_conversion:
          enabled: true # by default resource attributes are dropped
    service:
      telemetry:
        metrics:
          address: ":8888"
      pipelines:
        metrics:
          exporters: [prometheus]

1
Collector の内部メトリクスエンドポイントと Prometheus エクスポーターメトリクスエンドポイントをスクレイプする Prometheus ServiceMonitor CR を作成するように Operator を設定します。メトリクスは OpenShift モニタリングスタックに保存されます。

あるいは、手動で作成した Prometheus PodMonitor CR を使用すると、Prometheus のスクレイピング中に追加された重複ラベルの削除など、細かい制御を行うことができます。

Collector メトリクスをスクレイプするようにモニタリングスタックを設定する PodMonitor CR の例

Copy to Clipboard Toggle word wrap
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: otel-collector
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: <cr_name>-collector 
1

  podMetricsEndpoints:
  - port: metrics 
2

  - port: promexporter 
3

    relabelings:
    - action: labeldrop
      regex: pod
    - action: labeldrop
      regex: container
    - action: labeldrop
      regex: endpoint
    metricRelabelings:
    - action: labeldrop
      regex: instance
    - action: labeldrop
      regex: job

1
OpenTelemetry Collector CR の名前。
2
OpenTelemetry Collector の内部メトリクスポートの名前。このポート名は、必ず metrics になります。
3
OpenTelemetry Collector の Prometheus エクスポーターポートの名前。
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat, Inc.