|
| 1 | +--- |
| 2 | + |
| 3 | +rules: |
| 4 | + # Rule for ClassLoading metrics |
| 5 | + - bean: java.lang:type=ClassLoading |
| 6 | + mapping: |
| 7 | + LoadedClassCount: |
| 8 | + {%- set m_class_loaded = (ctx.groups | selectattr("id", "equalto", "jvm.class.loaded") | first) %} |
| 9 | + metric: jvm.classes.loaded |
| 10 | + type: gauge |
| 11 | + unit: "{{ m_class_loaded.unit | safe }}" |
| 12 | + desc: number of loaded classes |
| 13 | + |
| 14 | + # Rule for Garbage Collector metrics |
| 15 | + - bean: java.lang:type=GarbageCollector,name=* |
| 16 | + mapping: |
| 17 | + {%- for m in ctx.groups if m.id in ["jvm.gc.collections.count", "jvm.gc.collections.elapsed"] -%} |
| 18 | + {%- if m.id == "jvm.gc.collections.count" %} |
| 19 | + CollectionCount: |
| 20 | + metric: {{ m.id | safe }} |
| 21 | + type: {{ m.instrument | safe }} |
| 22 | + unit: "{{ m.unit | safe }}" |
| 23 | + desc: total number of collections that have occurred |
| 24 | + metricAttribute: |
| 25 | + name: param(name) |
| 26 | + {%- elif m.id == "jvm.gc.collections.elapsed" %} |
| 27 | + CollectionTime: |
| 28 | + metric: {{ m.id | safe}} |
| 29 | + type: {{ m.instrument | safe }} |
| 30 | + unit: {{ m.unit | safe }} |
| 31 | + desc: the approximate accumulated collection elapsed time in milliseconds |
| 32 | + metricAttribute: |
| 33 | + name: param(name) |
| 34 | + {%- endif %} |
| 35 | + {%- endfor %} |
| 36 | + |
| 37 | + # Rule for Heap and Non-Heap Memory metrics |
| 38 | + - bean: java.lang:type=Memory |
| 39 | + unit: By |
| 40 | + prefix: jvm.memory. |
| 41 | + mapping: |
| 42 | + {%- for m in ctx.groups if m.id.startswith("jvm.memory.heap") %} |
| 43 | + {%- if m.id == "jvm.memory.heap.committed" %} |
| 44 | + HeapMemoryUsage.committed: |
| 45 | + metric: heap.committed |
| 46 | + desc: current heap usage |
| 47 | + type: gauge |
| 48 | + {%- elif m.id == "jvm.memory.heap.init" %} |
| 49 | + HeapMemoryUsage.init: |
| 50 | + metric: heap.init |
| 51 | + desc: current heap usage |
| 52 | + type: gauge |
| 53 | + {%- elif m.id == "jvm.memory.heap.max" %} |
| 54 | + HeapMemoryUsage.max: |
| 55 | + metric: heap.max |
| 56 | + desc: current heap usage |
| 57 | + type: gauge |
| 58 | + {%- elif m.id == "jvm.memory.heap.used" %} |
| 59 | + HeapMemoryUsage.used: |
| 60 | + metric: heap.used |
| 61 | + desc: current heap usage |
| 62 | + type: gauge |
| 63 | + {%- endif %} |
| 64 | + {%- endfor %} |
| 65 | + {%- for m in ctx.groups if m.id.startswith("jvm.memory.nonheap") %} |
| 66 | + {%- if m.id == "jvm.memory.nonheap.committed" %} |
| 67 | + NonHeapMemoryUsage.committed: |
| 68 | + metric: nonheap.committed |
| 69 | + desc: current non-heap usage |
| 70 | + type: gauge |
| 71 | + {%- elif m.id == "jvm.memory.nonheap.init" %} |
| 72 | + NonHeapMemoryUsage.init: |
| 73 | + metric: nonheap.init |
| 74 | + desc: current non-heap usage |
| 75 | + type: gauge |
| 76 | + {%- elif m.id == "jvm.memory.nonheap.max" %} |
| 77 | + NonHeapMemoryUsage.max: |
| 78 | + metric: nonheap.max |
| 79 | + desc: current non-heap usage |
| 80 | + type: gauge |
| 81 | + {%- elif m.id == "jvm.memory.nonheap.used" %} |
| 82 | + NonHeapMemoryUsage.used: |
| 83 | + metric: nonheap.used |
| 84 | + desc: current non-heap usage |
| 85 | + type: gauge |
| 86 | + {%- endif %} |
| 87 | + {%- endfor %} |
| 88 | + |
| 89 | + # Rule for Memory Pool metrics |
| 90 | + - bean: java.lang:type=MemoryPool,name=* |
| 91 | + type: gauge |
| 92 | + unit: By |
| 93 | + metricAttribute: |
| 94 | + name: param(name) |
| 95 | + mapping: |
| 96 | + {%- for m in ctx.groups if m.id.startswith("jvm.memory.pool") %} |
| 97 | + {%- if m.id == "jvm.memory.pool.committed" %} |
| 98 | + Usage.committed: |
| 99 | + metric: jvm.memory.pool.committed |
| 100 | + desc: current memory pool usage |
| 101 | + {%- elif m.id == "jvm.memory.pool.init" %} |
| 102 | + Usage.init: |
| 103 | + metric: jvm.memory.pool.init |
| 104 | + desc: current memory pool usage |
| 105 | + {%- elif m.id == "jvm.memory.pool.max" %} |
| 106 | + Usage.max: |
| 107 | + metric: jvm.memory.pool.max |
| 108 | + desc: current memory pool usage |
| 109 | + {%- elif m.id == "jvm.memory.pool.used" %} |
| 110 | + Usage.used: |
| 111 | + metric: jvm.memory.pool.used |
| 112 | + desc: current memory pool usage |
| 113 | + {%- endif %} |
| 114 | + {%- endfor %} |
| 115 | + |
| 116 | + # Rule for Threading metrics |
| 117 | + - bean: java.lang:type=Threading |
| 118 | + mapping: |
| 119 | + ThreadCount: |
| 120 | + {%- set m_threads_count = (ctx.groups | selectattr("id", "equalto", "jvm.threads.count") | first) %} |
| 121 | + metric: {{ m_threads_count.id | safe}} |
| 122 | + unit: "{{ m_threads_count.unit | safe }}" |
| 123 | + desc: number of threads |
0 commit comments