Metrics
The Exot Inspector includes the metrics instrument for collecting time-series data, such as CPU and memory usage, request latency, etc.
Metrics are built on top of the measurements module, which includes an in-memory store. To integrate metrics with persistent storage, refer to the Data stores documentation.
Instrument
Access the metrics instrument via the metrics
namespace:
Configuration
Configure the metrics instrument using the main Inspector configuration options:
Available configuration options:
dashboards: Dashboard[]
An array of custom dashboards.disabled: boolean
: Disables the instrument. When disabled, the instrument cannot be activated, and no data will be recorded (defaultfalse
).measurements: MeasurementConfig[]
An array of custom measurements.
Dashboards
The Inspector Application offers dashboards and charts to explore recorded metrics. Dashboards can be easily adjusted using the JSON dashboard configuration, and you can also add custom measurements and dashboards.
Monitoring dashboard
The default built-in dashboard named Monitoring includes CPU, memory, event loop delay, request count, and request latency metrics.
Custom dashboards
To add a custom dashboard, define a new dashboard in the Inspector configuration options.
Recording Metrics
To record a measurement, use the push
function:
Querying metrics
While recorded metrics can be viewed in the Application, you can programmatically retrieve metrics using the query()
function.
Sensors
The Inspector includes several built-in sensors for measuring runtime metrics.
CPU Sensor
Sensor name: cpu
The CPU sensor measures the CPU utilization using Node’s process.cpuUsage() function.
Memory Sensors
Sensor names:
memory-heap
memory-rss
There are two memory sensors: memory-heap
and memory-rss
, which collect the current memory usage using Node’s process.memoryUsage().
Event Loop Delay Sensor
Sensor name: event-loop-delay
The event loop delay (or lag) is the time span between a function’s scheduling and its actual execution. It’s an important metric indicating how “busy” a process is.
To learn more about Node’s event loop, visit the Node.js documentation.