Custom metrics¶
You can extend any Refinery component to include the common process-wide monitoring metrics or have additional metrics defined.
Adding common metrics to a new process¶
To add the common metrics to a new process, use the following code in the process initialization function:
/ Monitoring 2.0 - connectivity and common metrics
.al.loadinstruction each `.daas.cmon.conn`.daas.cmon.common
.daas.cmon.init[]
.daas.cmon.common.init[]
Defining new metrics¶
When defining new metrics:
- Define them during process initialization to ensure that they are correctly registered with the daemon.
- Timer-based metrics must send data to the daemon on the configured interval else they will be marked as stale.
Two types of metrics can be defined:
- Event-based metrics occur on a specific event. They are not expected to occur regularly.
- Timer-based metrics occur at a regular interval.
For both event-based and timer-based metrics, the type of data to be sent must either be a dictionary or table.
Event-based¶
To define an event-based metric, specify the name of the metric and the data type to .daas.cmon.addEventMetric:
.daas.cmon.addEventMetric[`process.exit; `dict];
Whenever the event occurs, reference the name of the metric and the data to send to the Monitoring daemon:
/ Event-based metric generation function on process exit
/ @see .ch.addExit
.daas.cmon.common.onProcessExit:{
.daas.cmon.sendMetrics[`process.exit; enlist[`exitCode]!enlist x]; }
Timer-based¶
To define a timer-based metric, specify the function that will generate the metric and the interval. The .daas.cmon.addTimerMetric function will then schedule the job.
/ Send the current process timeout every 1 minute
.daas.cmon.addTimerMetric
[`process.queryTimeout; `.daas.cmon.common.processTimeout; `timespan$00:01:00; `dict]
And the function to be executed on the timer:
/ Common monitoring metric generation function on a timer for query timeout
.daas.cmon.common.processTimeout:{
.daas.cmon.sendMetrics[`process.queryTimeout; enlist[`timeoutSecs]!enlist system "T"]; }
Enabling capture of new metrics¶
If the capture of Monitoring data into Refinery is enabled, new metric transformer functions are required in the feed handler configuration to capture the new metrics. These can be added into the Delta configuration .daas.cfg.monFhTransformers with the following values:
metricName name of the metric to transform
transformFunc transformer function as a symbol reference
targetTable target table name of the transformed data
The configuration is pushed to the feed handler immediately. Generally speaking, all new metrics should go into the generic ProcessMetric table with the generic process-metric transformer:
configuration default value
----------------------------------------
transformFunc .mfh.t.genericProcMetric
targetTable ProcessMetric
If a new table is required, add it to the DAAS_MONITORING schema group in Delta Control.