LoginSignup
1
0

OCI O&M APMのAbridged Tracesの機能を試してみた

Posted at

Oracle Cloud Observability & ManagementのApplication Performance Monitoringの「Abridged Traces(簡易トレース)」の機能を検証してみました。
ドキュメントはこちらです。

機能について
Abridged Tracesとは、APMで収集される1つのトレース内で収集するスパンを制御することができる機能のようです。
トレースはHTTP_CLIENT, BROWSER, JDBC, SPRING, SERVLETなどさまざまなスパンによって構成されていますが、今回はAbridged Tracesの機能で、条件に基づいて収集するスパンを制限してみます。

Abridged Tracesは以下のようなユースケースが考えられます。

  • 処理時間が長いスパンだけを収集する
  • 監視に必要のないスパンの収集を制限する

前提条件

  • Application Performance MonitoringのAPM JavaエージェントがAPサーバーにインストール、デプロイされていること

注意点

  • エージェントがデプロイ済の環境では、APサーバーを再起動する必要があります。

1. APM環境の確認

APMの画面からトレースの内容を確認してみます。

image.png

このトレース(オペレーション)では、SERVLET、SPRING、JDBCのスパンが合計6個収集されていることが分かります。
今回は1つのトレースの中で収集されるSPRINGのスパンを1個に制限してみます。

2. 構成ファイルの修正

Abridged Tracesの設定ファイルは、oracle-apm-agent/config/$AgentVersionディレクトリ下にあります。
oracle-apm-agent/config/$AgentVersionのディレクトリ配下にあるProbeConfig.acmlファイルを修正します。

ProbeConfig.acmlファイルを開くと、ファイルの一番最後にabridged_probesの設定項目があるので、テンプレートを参考に修正してみました。

oracle-apm-agent/config/$AgentVersion/ProbeConfig.acmlのテンプレート
# Configuration options for abridging probes in probes_list once span_limit spans have
# been generated in a thread for a given call. An abridged probe does no work and generates no spans. 
abridged_probes:
  # The span limit after which probes in probes_list become abridged.
  # This limit is for total number of spans from ALL probes in probes_list. It is NOT per prob
  # The list of probes whose spans contribute towards the span_limit
  # and which become abridged once span_limit is reached.
summarize: true 
 settings_by_probe: 

  # set to true to receive a summary of dropped spans
  # The following example is of a probe specific configuration, it would typically be used in place of the above for
  # finer control over how many spans from each probe get collected per call, per thread
  # Example:
  #  settings_by_probe:
  #    - probe: "JDBC"                   <-- Can use "ALL_PROBES" to specify a default
  #      span_limit: 50                  <-- This limits JDBC probe to 50 spans per call, per thread
  #      excluded_patterns:              <-- Exclude/Include spans based on operation name. Takes precedent over other abridged settings.
  #                                          Patterns are executed in order, and the first match determines whether it is included or excluded
  #        - contains: "exclude"         <-- Basic 'contains' string check of operation name
  #          excluded: true              <-- Setting to true indicates matching spans should be dropped/excluded
  #        - pattern: ".*exclude.*"      <-- Regex based matching on operation name, less performant than simple 'contains' check
  #          excluded: true
  #      raw_excluded_patterns:          <-- Exclude/Include spans based on raw SQL or un-normalized name. Executes before excluded_patterns.
  #        - contains: "IncludeRaw"
  #          excluded: false             <-- Set to false to indicate the span should be included and not dropped
  #        - pattern: ".*ExcludeRaw.*"
  #          excluded: true
  #      excluded_patterns_DbStatement:  <-- Exclude/Include JDBC spans based on DbStatement tag. For agent 1.10->1.11 backwards compatibility
  #        - contains: "IncludeRaw"
  #          excluded: false             <-- Set to false to indicate the span should be included and not dropped
  #        - pattern: ".*ExcludeRaw.*"
  #          excluded: true
  #      threshold:                      <-- Span duration based thresholding. May result in ORPHANED CHILD SPANS.
  #                                          Meaning child spans are sent to the APM cloud but the parent span is
  #                                          dropped due to threshold.
  #        duration: 10                  <-- Value is in milliseconds and indicates spans taking less than 10ms should be dropped.
  #        start_thresholding_after: 25  <-- Indicates the number of spans to capture before starting to thresh out fast spans
  #
  # The following example is of an operation specific configuration, it would typically be used for
  # finer control over how many spans from a specific operation get collected per call, per thread
  # Example:
  #  settings_by_operation:
  #    -                                          <-- The opening hyphen is required
  #      name: "/important.jsp"                   <-- Exact name of the operation.  Some operation names aren't
  #                                                   known until the end of processing and aren't supported.
  #                                                   Currently this is only custom probe operations with variables
  #                                                   known only at the end of processing.
  #      span_limit: 500                          <-- This sets the span limit for /important.jsp to 500. The limit
  #                                                   is for child spans only, the root span is not part of the count.
  settings_by_operation: ~

テンプレートを参考に、今回は1つのトレース内で収集されるスパンの個数を最大5個、SPRINGのスパンは1トレース内で1個までしか収集しない、という設定をしてみました。

abridged_probes:
 span_limit:5
 probes_list:
  - "SPRING"
 summarize: true
 settings_by_probe:
  - probe: "SPRING"
    span_limit: 1

3. APサーバーの再起動

ProbeConfig.acmlファイルを修正したら、修正内容を反映するためにAPサーバを再起動します。

今回、私の環境はSPRINGBOOTなので、以下コマンドでSPRINGBOOTを再起動します。

$java -javaagent:<Destination Directory>/oracle-apm-agent/bootstrap/ApmAgent.jar -jar target/springboot.jar

APサーバを再起動したら、再度収集されているトレースを確認します。

image.png

同じトレースのオペレーションで、スパンが4個しか収集されていないことが分かります。

また、ルートスパンの詳細画面からログエントリを確認すると、EventログからAbridged Tracesの機能によってSPRINGのスパンの収集個数制限に引っかかったことが分かります。
image.png

また、TopAbridgedByDurationのログエントリからは、収集されなかったSPRINGのスパンの実行時間とスパン名を確認することができました。
image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0