コールグラフ プロファイリングへのデータの取得

Splunk APM のコールグラフ プロファイリングにプロファイリングデータを取り込む方法を学習します。

コールグラフ プロファイリングにデータを取得するための次の高度な手順を完了します。

  1. 前提条件を満たしていることを確認します
  2. アプリケーションをインストゥルメンテーションする
  3. コールグラフ プロファイリングの有効化

前提条件

Splunk APM のコールグラフ プロファイリングにデータを取り込むための前提条件について説明します。

Splunk APM コールグラフ プロファイリングにデータを取得するには、次の要件を満たす必要があります。

Helm チャートを展開するための追加の前提条件

Helm を使用して Splunk Distribution of the OpenTelemetry Collector をデプロイする場合は、チャートをインストールする際に以下の値を渡す必要があります。
--set splunkObservability.profilingEnabled='true'
values.yaml ファイル自体でパラメータを編集することもできます。例:
# This option enables only the shared pipeline for logs and profiling data.
# There is no active collection of profiling data.
# Instrumentation libraries must be configured to send it to the collector.
# If you don't use Call Graph Profiling for Splunk APM, you can disable it.
profilingEnabled: false
注: profileEnabledtrue に設定すると、コールグラフ プロファイリングに必要なログパイプラインが作成されますが、APM のインストゥルメンテーションはインストールされません。インストゥルメントをインストールするには、次のセクションを参照してください。
OTel Collector の 0.78.0 より低いバージョンを使用している場合は、ログ収集を必ずオフにしてください。
logsEnabled: false

Instrument your application

Learn how to instrument your application for Call Graph Profiling in Splunk APM.

Call Graph Profiling requires APM tracing data to correlate stack traces to your application requests. To instrument your application for Splunk APM, follow the steps for the appropriate programming language.
LanguageAvailable instrumentationDocumentation
JavaSplunk Distribution of OpenTelemetry Java version 2.15.0 or higher
In Java environments, Call Graph Profiling supports monitoring synchronous and asynchronous threads.

For information on data retention, see Data retention in Application Performance Monitoring (APM).

コールグラフ プロファイリングの有効化

Splunk APM でコールグラフ プロファイリングをアクティブ化する方法について説明します。

Splunk Observability Cloud のアプリケーションをインストゥルメント化したら、Java エージェントでコールグラフ プロファイリングを有効にします。

  1. 次に示すように、splunk.snapshot.profiler.enabled システムプロパティを true に設定します。
    java -javaagent:./splunk-otel-javaagent.jar \
    -Dsplunk.snapshot.profiler.enabled=true \
    -Dotel.exporter.otlp.endpoint=http(s)://collector:4317 \
    -jar <your_application>.jar
    SPLUNK_SNAPSHOT_PROFILE_ENABLED 環境変数を使用して、コールグラフ プロファイリングを有効にすることもできます。環境変数の使用の詳細については、「コールグラフ プロファイリングの Java 設定」を参照してください。

  2. プロファイリングデータをエクスポートするOTLPエンドポイントが正しく設定されていることを確認します:

  • プロファイリング固有のエンドポイントは、splunk.profiler.logs-endpoint システムプロパティまたは SPLUNK_PROFILER_LOGS_ENDPOINT 環境変数で設定します。

    • このエンドポイントが設定されていない場合、汎用のOTLPエンドポイントが使用され、otel.exporter.otlp.endpoint システムプロパティまたは OTEL_EXPORTER_OTLP_ENDPOINT 環境変数によって設定されます。

    • このエンドポイントも設定されていない場合は、デフォルトの http://localhost:4317 になります。

  • Kubernetes 以外の展開の場合、OTLP エンドポイントは http://${COLLECTOR_IP}:4317 を指す必要があります。コレクタとプロファイリングされたアプリケーションが同じホストで実行されている場合は、http://localhost:4317 を使用します。他の場合は、プロファイリングされたホストからコレクタホストへのポート 4317 へのアクセスをブロックするファイアウォールルールがないことを確認してください。

  • Kubernetes デプロイメントの場合、OTLP エンドポイントは http://$(K8S_NODE_IP):4317 を指す必要があります。ここで K8S_NODE_IP は、アプリケーションを実行している Kubernetes ポッド上の環境構成を設定することにより、Kubernetes ダウンストリーム API からフェッチされます。例:
    env:
    - name: K8S_NODE_IP
      valueFrom:
        fieldRef:
          apiVersion: v1
          fieldPath: status.hostIP
    ポート 9943 は、コレクタ ディストリビューションの Splunk 受信者のデフォルトポートです。コレクタの構成でこのポートを変更した場合、カスタムポートを JVM に渡す必要があります。

プロファイリングデータ用に別のエンドポイントを設定するなど、その他の設定オプションについては、「コールグラフ プロファイリングの Java 設定」を参照してください。

Activate Call Graph Profiling in a gateway deployment

Learn how to activate Call Graph Profiling in a gateway deployment in Splunk APM.

Follow these steps to set up Call Graph Profiling with a collector in data forwarding or gateway mode, similar to the following example gateway deployment:

  1. Point the instrumentation agent to the OTLP gRPC receiver for the collector in host monitoring (agent) mode. The OTLP gRPC receiver must be running on the same host and port as the collector in host monitoring (agent) mode.

  2. Configure the collector in host monitoring (agent) mode with the following components:

    • An OTLP gRPC receiver

    • An OTLP exporter pointed at the collector in data forwarding (gateway) mode

    • A logs pipeline that connects the receiver and the exporter. For example, see the default agent configuration with the necessary adjustment to send to a gateway in the Splunk OpenTelemetry Collector on GitHub.
      >>service:
         pipelines:
            logs:
               receivers: [otlp]
               processors:
               - memory_limiter
               - batch
               - resourcedetection
               #- resource/add_environment
               #exporters: [splunk_hec, splunk_hec/profiling]
               # Use instead when sending to gateway
               exporters: [otlp]
  3. Configure the collector in data forwarding (gateway) mode with the following components:

    1. An OTLP gRPC receiver.

    2. A splunk_hec exporter.

    3. A logs pipeline that connects the receiver and the exporter.