JMX 自訂度量
若要配置要監視的 JMX 度量,請編輯代理程式 configuration.yaml 檔案。
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
上述範例中指定兩種類型的度量值:
delta用於隨著時間而增加的值,例如計數器,其中會將相對變更視為感興趣。absolute用來顯示每次存取度量時的實際值。
指定的屬性必須是 Number (或它的其中一個子類別,例如 Integer 或 Double) 或代表數字的 String 。
在 JVM 儀表板上, JMX 度量會顯示在 自訂 JMX 度量之下。
object_name 可能包含萬用字元型樣,如 Java 的 ObjectName 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'