Closed bmomcilov closed 1 year ago
To read more about Dropwizard Metrics navigate here.
<metrics class="org.jpos.ee.metrics.Metrics" default="true"> <reporter-factory class="org.jpos.ee.metrics.Q2LogReporterFactory"> <output-frequency>30</output-frequency> <output-frequency-unit>SECONDS</output-frequency-unit> <rates-unit>SECONDS</rates-unit> <durations-unit>MILLISECONDS</durations-unit> <exclude-attributes>P50</exclude-attributes> <exclude-attributes>P75</exclude-attributes> <exclude-attributes>P98</exclude-attributes> </reporter-factory> </metrics>
This will produce and register a new shared metric registry that can be accessed by the Bean name. To get an instance of the MetricRegistry use:
MetricRegistry
MetricRegistry metricRegistry = SharedMetricRegistries.tryGetDefault();
Example output of the Q2LogReporter
Q2LogReporter
<log realm="metrics" at="2022-11-28T08:41:40.668" lifespan="1ms"> <info> jvm.buffers.direct.capacity=8192 jvm.buffers.direct.count=1 jvm.buffers.direct.used=8192 jvm.buffers.mapped.capacity=0 jvm.buffers.mapped.count=0 jvm.buffers.mapped.used=0 jvm.classloader.loaded=13194 jvm.classloader.unloaded=0 jvm.filedescriptor=4.673004150390625E-4 jvm.gc.ConcurrentMarkSweep.count=2 jvm.gc.ConcurrentMarkSweep.time=102 jvm.gc.ParNew.count=4 jvm.gc.ParNew.time=91 jvm.memory.heap.committed=1037959168 jvm.memory.heap.init=1073741824 jvm.memory.heap.max=1037959168 jvm.memory.heap.usage=0.07452811091697974 jvm.memory.heap.used=77357136 jvm.memory.non-heap.committed=106778624 jvm.memory.non-heap.init=2555904 jvm.memory.non-heap.max=-1 jvm.memory.non-heap.usage=-1.0476936E8 jvm.memory.non-heap.used=104769360 jvm.memory.pools.CMS-Old-Gen.committed=715849728 jvm.memory.pools.CMS-Old-Gen.init=715849728 jvm.memory.pools.CMS-Old-Gen.max=715849728 jvm.memory.pools.CMS-Old-Gen.usage=0.03175904538445253 jvm.memory.pools.CMS-Old-Gen.used=22734704 jvm.memory.pools.CMS-Old-Gen.used-after-gc=22542680 jvm.memory.pools.Code-Cache.committed=23396352 jvm.memory.pools.Code-Cache.init=2555904 jvm.memory.pools.Code-Cache.max=251658240 jvm.memory.pools.Code-Cache.usage=0.09241307576497396 jvm.memory.pools.Code-Cache.used=23256512 jvm.memory.pools.Compressed-Class-Space.committed=9613312 jvm.memory.pools.Compressed-Class-Space.init=0 jvm.memory.pools.Compressed-Class-Space.max=1073741824 jvm.memory.pools.Compressed-Class-Space.usage=0.008687876164913177 jvm.memory.pools.Compressed-Class-Space.used=9328536 jvm.memory.pools.Metaspace.committed=73768960 jvm.memory.pools.Metaspace.init=0 jvm.memory.pools.Metaspace.max=-1 jvm.memory.pools.Metaspace.usage=0.9785352538520267 jvm.memory.pools.Metaspace.used=72185528 jvm.memory.pools.Par-Eden-Space.committed=286326784 jvm.memory.pools.Par-Eden-Space.init=286326784 jvm.memory.pools.Par-Eden-Space.max=286326784 jvm.memory.pools.Par-Eden-Space.usage=0.06579816158588922 jvm.memory.pools.Par-Eden-Space.used=18839776 jvm.memory.pools.Par-Eden-Space.used-after-gc=0 jvm.memory.pools.Par-Survivor-Space.committed=35782656 jvm.memory.pools.Par-Survivor-Space.init=35782656 jvm.memory.pools.Par-Survivor-Space.max=35782656 jvm.memory.pools.Par-Survivor-Space.usage=1.0 jvm.memory.pools.Par-Survivor-Space.used=35782656 jvm.memory.pools.Par-Survivor-Space.used-after-gc=35782656 jvm.memory.total.committed=1144737792 jvm.memory.total.init=1076297728 jvm.memory.total.max=1037959167 jvm.memory.total.used=182127712 jvm.threads.blocked.count=0 jvm.threads.count=51 jvm.threads.daemon.count=23 jvm.threads.deadlock.count=0 jvm.threads.deadlocks=[] jvm.threads.new.count=0 jvm.threads.peak.count=74 jvm.threads.runnable.count=5 jvm.threads.terminated.count=0 jvm.threads.timed_waiting.count=36 jvm.threads.total_started.count=79 jvm.threads.waiting.count=10 ... </info>
<health class="org.jpos.ee.metrics.Health" default="true"> <check class="my.custom.ConnectivityCheck"> <host>127.0.0.1</host> <port>9003</port> </check> </health>
You can access your new HealthCheckRegistry in a similar way:
HealthCheckRegistry
SharedHealthCheckRegistries.tryGetDefault();
Support for Dropwizard Metrics
To read more about Dropwizard Metrics navigate here.
How is this supposed to be used?
Metrics
$DEPLOY_DIRECTORY/01_metrics.xml
This will produce and register a new shared metric registry that can be accessed by the Bean name. To get an instance of the
MetricRegistry
use:Example output of the
Q2LogReporter
Health checks
$DEPLOY_DIRECTORY/99_health.xml
You can access your new
HealthCheckRegistry
in a similar way: