Skip to main content

Application Metrics

DB2Rest provides a metrics endpoint that you can use diagnostically to examine the metrics collected by the running application. Navigating to /actuator/metrics displays a list of available meter names.


curl --request GET \
--url http://localhost:8080/actuator/metrics \
--header 'User-Agent: insomnia/9.2.0'


This will list the names of all the meters available to query.

HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked

{
"names": [
"application.ready.time",
"application.started.time",
"disk.free",
"disk.total",
"http.server.requests",
"http.server.requests.active",
"jvm.buffer.count",
"jvm.buffer.memory.used",
"jvm.buffer.total.capacity",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"jvm.compilation.time",
"jvm.gc.live.data.size",
"jvm.gc.max.data.size",
"jvm.gc.memory.allocated",
"jvm.gc.memory.promoted",
"jvm.gc.overhead",
"jvm.gc.pause",
"jvm.info",
"jvm.memory.committed",
"jvm.memory.max",
"jvm.memory.usage.after.gc",
"jvm.memory.used",
"jvm.threads.daemon",
"jvm.threads.live",
"jvm.threads.peak",
"jvm.threads.started",
"jvm.threads.states",
"logback.events",
"process.cpu.time",
"process.cpu.usage",
"process.files.max",
"process.files.open",
"process.start.time",
"process.uptime",
"system.cpu.count",
"system.cpu.usage",
"system.load.average.1m",
"tomcat.sessions.active.current",
"tomcat.sessions.active.max",
"tomcat.sessions.alive.max",
"tomcat.sessions.created",
"tomcat.sessions.expired",
"tomcat.sessions.rejected"
]
}

It is possible to drill down to view information about a particular meter by providing its name as a selector - for example, /actuator/metrics/jvm.memory.max.


curl --request GET \
--url http://localhost:8080/actuator/metrics/jvm.memory.max \
--header 'User-Agent: insomnia/9.2.0'


The response of this metrics query is shown below:

HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked

{
"name": "jvm.memory.max",
"description": "The maximum amount of memory in bytes that can be used for memory management",
"baseUnit": "bytes",
"measurements": [
{
"statistic": "VALUE",
"value": 5.419040765E9
}
],
"availableTags": [
{
"tag": "area",
"values": [
"heap",
"nonheap"
]
},
{
"tag": "id",
"values": [
"G1 Survivor Space",
"Compressed Class Space",
"CodeCache",
"G1 Old Gen",
"Metaspace",
"G1 Eden Space"
]
}
]
}