JMX カスタム・メトリック

監視する JMX のメトリクスを設定するには、次の例に示す configuration.yaml ようにagentファイルを編集してください:

com.instana.plugin.java:
  jmx:
    # JMX is NOT hot-reloaded and needs to be set before a JVM is discovered.
    # Supported attribute types are Number and Boolean
    # delta calculation is only supported for Number
    - object_name: 'java.lang:type=Compilation'
      metrics:
        - attributes: 'TotalCompilationTime'
          type: 'delta' # delta will report the change to the previous second
    - object_name: 'java.lang:type=ClassLoading'
      metrics:
        - attributes: 'LoadedClassCount'
          type: 'absolute' # absolute will report the value as-is

この configuration.yaml 例では、2種類のメトリクスが指定されています:

  • delta は、時間の経過につれて増加する値 (例えば、相対的な変更が興味深いと見なされるカウンターなど) に使用されます。
  • absolute は、メトリックがアクセスされるたびに実際の値を表示するために使用されます。

指定される属性は、Number (または Integer または Double などのサブクラスのいずれか)、もしくは数値を表すString のいずれかでなければなりません。

JVM ダッシュボードで、JMX メトリックは「カスタム JMX メトリック」の下に表示されます。

には、 Java のドキュメント( object_nameObjectName API )で指定されているワイルドカードパターンを含めることができます。 ワイルドカード・パターンを使用した構成の例を以下に示します。

com.instana.plugin.java:
  jmx:
    - object_name: 'kafka.*:type=*-metrics,client-id=*,*'
      metrics:
        - attributes: 'incoming-byte-rate'
          type: 'absolute'
        - attributes: 'incoming-byte-total'
          type: 'absolute'
        - attributes: 'outgoing-byte-rate'
          type: 'absolute'
        - attributes: 'outgoing-byte-total'
          type: 'absolute'