モニタリングおよびロギング


Red Hat Developer Hub 1.6

Red Hat Developer Hub のモニタリングおよびロギングツールでパフォーマンスを追跡し、洞察を収集

Red Hat Customer Content Services

概要

Red Hat Developer Hub のオペレーションマネージャーまたはプロジェクトマネージャーは、Red Hat Developer Hub のモニタリングおよびロギングツールを使用してパフォーマンスを監視し、知見を得ます。

第1章 OpenShift Container Platform 上の Red Hat Developer Hub に対する可観測性の有効化

OpenShift Container Platform では、メトリクスは /metrics の正規名の下に HTTP サービスエンドポイント経由で公開されます。ServiceMonitor カスタムリソース (CR) を作成して、ユーザー定義プロジェクトのサービスエンドポイントからメトリクスをスクレイピングできます。

1.1. Red Hat Developer Hub Operator で OpenShift Container Platform クラスターにインストールした場合にメトリクス監視を有効にする

OpenShift Container Platform Web コンソールの Developer パースペクティブから、Operator によってインストールした Red Hat Developer Hub インスタンスのメトリクスを有効にして表示できます。

前提条件

  • OpenShift Container Platform クラスターで、ユーザー定義プロジェクトの監視 が有効になっている。
  • Red Hat Developer Hub Operator を使用して、OpenShift Container Platform に Red Hat Developer Hub をインストールしている。
  • OpenShift CLI (oc) がインストールされている。

手順

現在、Red Hat Developer Hub Operator は、デフォルトで ServiceMonitor カスタムリソース (CR) の作成をサポートしていません。エンドポイントからメトリクスをスクレイピングするための ServiceMonitor CR を作成するには、次の手順を完了する必要があります。

  1. ServiceMonitor CR を YAML ファイルとして作成します。

    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      name: <developer_hub_service_monitor_name> 
    1
    
      namespace: <rhdh_namespace_name> 
    2
    
      labels:
        app.kubernetes.io/instance: <rhdh_cr_name> 
    3
    
        app.kubernetes.io/name: Backstage
    spec:
      namespaceSelector:
        matchNames:
          - <rhdh_namespace_name> 
    4
    
      selector:
        matchLabels:
          app.kubernetes.io/instance: <deployment_name> 
    5
    
          app.kubernetes.io/name: <rhdh_cr_type> 
    6
    
      endpoints:
      - port: http-metrics
        path: '/metrics'
    Copy to Clipboard
    1
    ServiceMonitor リソースの名前 (例: developer_hub_service_monitor)。
    2
    ServiceMonitor が存在する namespace (例: my-rhdh-project)。
    3
    ServiceMonitor CR インスタンスを識別するラベル名 (例: my-rhdh-custom-resource)。
    4
    RHDH インスタンスがインストールされている namespace (例: my-rhdh-project)。
    5
    RHDH デプロイメントの名前 (例: developer-hub)。
    6
    RHDH アプリケーションの名前 (例: backstage)。
    注記

    spec.selector.matchLabels 設定は、RHDH インストールのラベルと一致する必要があります。

  2. 次のコマンドを実行して、ServiceMonitor CR を適用します。

    oc apply -f <filename>
    Copy to Clipboard

検証

  1. OpenShift Container Platform Web コンソールの Developer パースペクティブから、Observe ビューを選択します。
  2. Metrics タブをクリックして、Red Hat Developer Hub Pod のメトリクスを表示します。
  3. OpenShift Container Platform Web コンソールの Developer パースペクティブで、Project > Services をクリックし、backstage-developer-hub のラベルを確認します。

1.2. Helm チャートで OpenShift Container Platform クラスターにインストールした場合にメトリクス監視を有効にする

OpenShift Container Platform Web コンソールの Developer パースペクティブから、Red Hat Developer Hub Helm デプロイメントのメトリクスを有効にして表示できます。

前提条件

  • OpenShift Container Platform クラスターで、ユーザー定義プロジェクトの監視 が有効になっている。
  • Helm チャートを使用して、OpenShift Container Platform に Red Hat Developer Hub をインストールしている。

手順

  1. OpenShift Container Platform Web コンソールの Developer パースペクティブから、Topology ビューを選択します。
  2. Red Hat Developer Hub Helm チャートのオーバーフローメニューをクリックし、Upgrade を選択します。

    Helm アップグレード
  3. Upgrade Helm Release ページで、Configure viaYAML view オプションを選択し、次の例に示すように、YAML で metrics セクションを設定します。

    upstream:
    # ...
      metrics:
        serviceMonitor:
          enabled: true
          path: /metrics
          port: http-metrics
    # ...
    Copy to Clipboard
    Helm メトリクスのアップグレード
  4. Upgrade をクリックします。

検証

  1. OpenShift Container Platform Web コンソールの Developer パースペクティブから、Observe ビューを選択します。
  2. Metrics タブをクリックして、Red Hat Developer Hub Pod のメトリクスを表示します。

第2章 Amazon Web Services (AWS) 上の Red Hat Developer Hub の監視とログ記録

リアルタイム監視には Amazon CloudWatch を使用し、包括的なロギングには Amazon Prometheus を使用するように Red Hat Developer Hub を設定できます。これは、Amazon Web Services (AWS) インフラストラクチャーで Developer Hub をホストする場合に便利です。

2.1. Amazon Prometheus によるモニタリング

包括的なロギングのために Amazon Prometheus を使用するように Red Hat Developer Hub を設定できます。Amazon Prometheus は、特定の Pod アノテーションを持つ Pod からデータを抽出します。

2.1.1. 前提条件

2.1.2. Red Hat Developer Hub Operator を使用して Amazon Prometheus でモニタリングするアノテーションの設定

Amazon Prometheus へのログ記録を有効にするには、Red Hat Developer Hub Operator を使用して必要な Pod アノテーションを設定できます。

手順

  1. Red Hat Developer Hub Operator の管理者として、次のようにデフォルト設定を編集して Prometheus アノテーションを追加します。

    # Update OPERATOR_NS accordingly
    $ OPERATOR_NS=rhdh-operator
    $ kubectl edit configmap backstage-default-config -n "${OPERATOR_NS}"
    Copy to Clipboard
  2. config map で deployment.yaml キーを見つけて、次のように spec.template.metadata.annotations フィールドにアノテーションを追加します。

    deployment.yaml: |-
      apiVersion: apps/v1
      kind: Deployment
      # --- truncated ---
      spec:
        template:
          # --- truncated ---
          metadata:
            labels:
             rhdh.redhat.com/app:  # placeholder for 'backstage-<cr-name>'
            # --- truncated ---
            annotations:
              prometheus.io/scrape: 'true'
              prometheus.io/path: '/metrics'
              prometheus.io/port: '9464'
              prometheus.io/scheme: 'http'
      # --- truncated ---
    Copy to Clipboard
  3. 変更を保存します。

検証

スクレイピングが機能するかどうかを確認するには、以下の手順を実行します。

  1. 次のように、kubectl を使用して Prometheus コンソールをローカルマシンにポート転送します。

    $ kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
    Copy to Clipboard
  2. Web ブラウザーを開いて http://localhost:9090 に移動し、Prometheus コンソールにアクセスします。
  3. process_cpu_user_seconds_total などの関連メトリクスを監視します。

2.1.3. Red Hat Developer Hub Helm チャートを使用して Amazon Prometheus でモニタリングするアノテーションの設定

Amazon Prometheus へのログ記録を有効にするには、Red Hat Developer Hub Helm チャートを使用して必要な Pod アノテーションを設定できます。

手順

  • backstage Pod に監視用のアノテーションを付けるには、values.yaml ファイルを次のように更新します。

    upstream:
      backstage:
        # --- TRUNCATED ---
        podAnnotations:
          prometheus.io/scrape: 'true'
          prometheus.io/path: '/metrics'
          prometheus.io/port: '9464'
          prometheus.io/scheme: 'http'
    Copy to Clipboard

検証

スクレイピングが機能するかどうかを確認するには、以下の手順を実行します。

  1. 次のように、kubectl を使用して Prometheus コンソールをローカルマシンにポート転送します。

    kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
    Copy to Clipboard
  2. Web ブラウザーを開いて http://localhost:9090 に移動し、Prometheus コンソールにアクセスします。
  3. process_cpu_user_seconds_total などの関連メトリクスを監視します。

2.2. Amazon CloudWatch によるログ記録

Red Hat Developer Hub 内のロギングは、Winston ライブラリー に依存します。デフォルトのログレベルは info です。より詳細なログを取得するには、Red Hat Developer Hub インスタンスで LOG_LEVEL 環境変数を debug に設定します。

2.2.1. Red Hat Developer Hub Operator を使用したアプリケーションログレベルの設定

Red Hat Developer Hub Operator を使用して、アプリケーションログレベルを設定できます。

手順

  • 次のように、カスタムリソースに環境変数 LOG_LEVEL を含めて、ログレベルを変更します。

    spec:
      # Other fields omitted
      application:
        extraEnvs:
          envs:
            - name: LOG_LEVEL
              value: debug
    Copy to Clipboard

2.2.2. Red Hat Developer Hub Helm チャートを使用したアプリケーションログレベルの設定

Red Hat Developer Hub Helm チャートを使用して、アプリケーションログレベルを設定できます。

手順

  • 環境変数 LOG_LEVEL を Helm チャート values.yaml ファイルに追加して、ログレベルを変更します。

    upstream:
      backstage:
        # --- Truncated ---
        extraEnvVars:
          - name: LOG_LEVEL
            value: debug
    Copy to Clipboard

2.2.3. Amazon CloudWatch からのログの取得

前提条件

  • CloudWatch Container Insights は、Amazon Elastic Kubernetes Service のログとメトリクスをキャプチャーするのに使用されます。詳細は、Logging for Amazon Elastic Kubernetes Service のドキュメントを参照してください。
  • ログとメトリクスをキャプチャーするには、Amazon CloudWatch Observability EKS アドオンをクラスターにインストールします。Container Insights のセットアップ後、Logs Insights または Live Tail ビューを使用してコンテナーログにアクセスできます。
  • CloudWatch は、すべてのコンテナーログが統合されるロググループに、次のように名前を付けます。

    /aws/containerinsights/<cluster_name>/application
    Copy to Clipboard

手順

  • Developer Hub インスタンスからログを取得するには、次のようなクエリーを実行します。

    fields @timestamp, @message, kubernetes.container_name
    | filter kubernetes.container_name in ["install-dynamic-plugins", "backstage-backend"]
    Copy to Clipboard

第3章 Red Hat Developer Hub の Azure Kubernetes Services (AKS) によるモニタリングおよびロギング

監視およびロギングは、Red Hat Developer Hub での Azure Kubernetes Services (AKS) の管理および保守に不可欠な要素です。Managed Prometheus Monitoring や Azure Monitor 統合などの機能により、管理者はリソース使用率を効率的に監視し、問題を診断し、コンテナー化されたワークロードの信頼性を確保できます。

3.1. Azure Monitor メトリクスの有効化

マネージド Prometheus モニタリングを有効にするには、次のように、新しいクラスターの作成か既存のクラスターの更新かに応じて、az aks create または az aks update コマンドで -enable-azure-monitor-metrics オプションを使用します。

az aks create/update --resource-group <your-ResourceGroup> --name <your-Cluster> --enable-azure-monitor-metrics
Copy to Clipboard

上記のコマンドは、Prometheus メトリクス を収集するメトリクスアドオンをインストールします。前のコマンドを使用すると、ネイティブの Azure Monitor メトリクスの両方を通じて Azure リソースのモニタリングを有効にできます。ポータルの Monitoring → Insights で結果を表示することもできます。詳細は、Monitor Azure resources with Azure Monitor を参照してください。

さらに、Managed Prometheus サービスと Azure Monitor の両方のメトリクスには、Azure Managed Grafana サービスからアクセスできます。詳細は、Link a Grafana workspace セクションを参照してください。

デフォルトでは、Prometheus は最小取り込みプロファイルを使用します。これにより、取り込み量が最適化され、スクレイピング頻度、ターゲット、および収集するメトリクスのデフォルト設定が指定されます。デフォルト設定は、カスタム設定を使用してカスタマイズできます。Azure では、スクレイピング設定やその他のメトリクスアドオン設定を提供するために、さまざまな ConfigMap の使用を含むさまざまな方法が提供されています。デフォルトの設定の詳細は、Default Prometheus metrics configuration in Azure Monitor および Customize scraping of Prometheus metrics in Azure Monitor managed service for Prometheus ドキュメントを参照してください。

3.2. モニタリング用のアノテーションの設定

Helm デプロイメントと Operator ベースのデプロイメントの両方で、Red Hat Developer Hub 固有のメトリクスを監視するためのアノテーションを設定できます。

Helm のデプロイメント

backstage Pod に監視用のアノテーションを付けるには、values.yaml ファイルを次のように更新します。

upstream:
  backstage:
    # --- TRUNCATED ---
    podAnnotations:
      prometheus.io/scrape: 'true'
      prometheus.io/path: '/metrics'
      prometheus.io/port: '9464'
      prometheus.io/scheme: 'http'
Copy to Clipboard
Operator がサポートするデプロイメント

手順

  1. Operator の管理者として、デフォルト設定を編集して、次のように Prometheus アノテーションを追加します。

    # Update OPERATOR_NS accordingly
    OPERATOR_NS=rhdh-operator
    kubectl edit configmap backstage-default-config -n "${OPERATOR_NS}"
    Copy to Clipboard
  2. ConfigMap で deployment.yaml キーを見つけて、次のようにアノテーションを spec.template.metadata.annotations フィールドに追加します。

    deployment.yaml: |-
      apiVersion: apps/v1
      kind: Deployment
      # --- truncated ---
      spec:
        template:
          # --- truncated ---
          metadata:
            labels:
             rhdh.redhat.com/app:  # placeholder for 'backstage-<cr-name>'
            # --- truncated ---
            annotations:
              prometheus.io/scrape: 'true'
              prometheus.io/path: '/metrics'
              prometheus.io/port: '9464'
              prometheus.io/scheme: 'http'
      # --- truncated ---
    Copy to Clipboard
  3. 変更を保存します。

検証

スクレイピングが機能するかどうかを確認するには、対応する Azure Monitor Workspace に移動し、Monitoring → Metrics でメトリクスを表示します。

3.3. Azure Kubernetes Services (AKS) を使用したログの表示

Kubernetes オブジェクトによって生成されたライブデータログにアクセスし、AKS 内の Container Insights でログデータを収集できます。

前提条件

  • Developer Hub が AKS にデプロイされている。

詳細は、Microsoft Azure Kubernetes Service への Red Hat Developer Hub のインストール を参照してください。

手順

Developer Hub インスタンスからのライブログの表示
  1. Azure Portal に移動します。
  2. リソースグループ <your-ResourceGroup> を検索し、AKS クラスター <your-Cluster> を見つけます。
  3. メニューから Kubernetes resources → Workloads を選択します。
  4. <your-rhdh-cr>-developer-hub デプロイメント (Helm チャートインストールの場合) または <your-rhdh-cr>-backstage デプロイメント (Operator ベースのインストールの場合) を選択します。
  5. 左側のメニューで Live Logs をクリックします。
  6. Pod を選択します。

    注記

    Pod は 1 つだけである必要があります。

ライブログデータが収集され、表示されます。

Container Engine からのリアルタイムログデータの表示
  1. Azure Portal に移動します。
  2. リソースグループ <your-ResourceGroup> を検索し、AKS クラスター <your-Cluster> を見つけます。
  3. メニューから MonitoringInsights を選択します。
  4. Containers タブに移動します。
  5. backend-backstage コンテナーを見つけてクリックすると、Container Engine によって生成されるリアルタイムログデータが表示されます。

法律上の通知

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

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

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

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

会社概要

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

Theme

© 2025 Red Hat