On this page:

17.4Metrics Endpoint

 

The Metrics endpoint is used to access runtime properties of the running node. It exposes functionality provided by the Dropwizard Metrics library.

17.4.1Fetch Local Metrics

 
This method requires the VIEW_METRICS permission.

This method will return the runtime metrics provided by a given module (and only those metrics that are specific to the selected module). This method provides only metrics for the local Node (i.e. the same node where the JSON Admin API is running). As a result it is very resilient and consumes very few resources, as it does not need to access any remote services or processes (e.g. it does not need to talk to a database).

Parameters

Required:

  • format: (optional) The output format to use. Can be any of the following values:
    • DROPWIZARD – The default Dropwizard export format
    • PROMETHEUS – The Prometheus native client format

To invoke:

GET http://localhost:9000/metrics/local/metrics?format=DROPWIZARD

The server will produce a response resembling the following:

{
  "version": "4.0.0",
  "gauges": {
    "fhir_endpoint.db_num_active": {
      "value": 0
    },
    "fhir_endpoint.db_num_idle": {
      "value": 3
    },
    "fhir_endpoint.fhir_searches_active": {
      "value": 0
    },
    "fhir_endpoint.ft_index_remaining": {
      "value": 0
    }
  }
}

For brevity only a small subset of the metrics are shown here but a real response might contain many more.

17.4.2Fetch Thread Dump

 
This method requires the VIEW_METRICS permission.

This method will return a thread dump for the local node.


To invoke:

GET http://localhost:9000/metrics/local/threads

The server will produce a response resembling the following:

"ForkJoinPool.commonPool-worker-7" id=174 state=TIMED_WAITING
    - waiting on (a java.util.concurrent.ForkJoinPool)
    - locked (a java.util.concurrent.ForkJoinPool)
    at java.base@11.0.2/jdk.internal.misc.Unsafe.park(Native Method)
    at java.base@11.0.2/java.util.concurrent.locks.LockSupport.parkUntil(LockSupport.java:275)
    at java.base@11.0.2/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1619)
    at java.base@11.0.2/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)

For brevity only a small subset of the threads are shown here but a real response might contain many more.