Metric updates are generally carried out inside event handlers. By overwriting these handlers, users can update metric values in response to various triggers ranging from HTTP requests to timer events.
The functions outlined below can be modified to allow a user to monitor events outside those exposed in exporter.q
.prom.
event handlers
on_poll
Prometheus poll request
on_pc
IPC socket connection closing
on_po
IPC socket connection opening
on_wc
Websocket connection closing
on_wo
Websocket connection opening
after_pg
Synchronous IPC socket request handler, call after execution
before_pg
Synchronous IPC socket request handler, call before execution
after_ps
Asynchronous IPC socket request handler, call after execution
before_ps
Asynchronous IPC socket request handler, call before execution
after_ph
HTTP GET request handler, call after execution
before_ph
HTTP GET request handler, call before execution
after_pp
HTTP POST request handler, call after execution
before_pp
HTTP POST request handler, call before execution
after_ws
Websocket request handler, call after execution
before_ws
Websocket request handler, call before execution
after_ts
Timer event handler, call after execution
before_ts
Timer event handler, call after execution
👉 Example invocations of these event handlers
Once the relevant event handlers have been defined to update the metric values, initialize the library with a call to .prom.init
.z.*
handlers after the call to .prom.init
will overwrite the Prometheus logic.
Correct usage is to load all process logic before loading the Prometheus library.
Synchronous IPC socket request handler, called after execution
.prom.after_pg[tmp;msg;res]
Where
tmp
is the object returned by.prom.before_pg
msg
is the object that was executedres
is the object returned by the execution ofmsg
HTTP GET request handler, called after execution
.prom.after_ph[tmp;(requestText;requestHeaderAsDictionary);res]
Where
tmp
is the object returned by.prom.before_ph
(requestText;requestHeaderAsDictionary)
is a HTTP GET requestres
is the object returned by the execution ofmsg
HTTP POST request handler, called after execution
.prom.after_pp[tmp;(requestText;requestHeaderAsDictionary);res]
Where
tmp
is the object returned by.prom.before_pp
(requestText;requestHeaderAsDictionary)
is a HTTP POST requestres
is the object returned by the execution ofmsg
Asynchronous IPC socket request handler, called after execution
.prom.after_ps[tmp;msg;res]
Where
tmp
is the object returned by.prom.before_ps
msg
is the object that was executedres
is the object returned by the execution ofmsg
Timer event handler, called after execution
.prom.after_ts[tmp;dtm;res]
Where
tmp
is the object returned by.prom.before_ts
dtm
is the timestamp at the start of executionres
is the object returned by the execution ofdtm
Websocket request handler, called after execution
.prom.after_ws[tmp;msg;res]
Where
tmp
is the object returned by.prom.before_ws
msg
is the object that was executedres
is the object returned by the execution ofmsg
Synchronous IPC socket request handler, called before execution
.prom.before_pg msg
Where msg
is the object to be executed, returns a tmp
object to be passed to the after handler.
HTTP GET request handler, called before execution
.prom.before_ph(requestText;requestHeaderAsDictionary)
Where (requestText;requestHeaderAsDictionary)
is an HTTP GET request, returns a tmp
object to be passed to the after handler.
HTTP POST request handler, called before execution
.prom.before_pp(requestText;requestHeaderAsDictionary)
Where (requestText;requestHeaderAsDictionary)
is an HTTP POST request, returns a tmp
object to be passed to the after handler.
Asynchronous IPC socket request handler, called before execution
.prom.before_ps msg
Where msg
is the object to be executed, returns a tmp
object to be passed to the after handler.
Timer event handler, called before execution
.prom.before_ts dtm
Where dtm
is the timestamp at the start of execution, returns a tmp
object to be passed to the after handler.
Websocket request handler, called before execution
.prom.before_ws msg
Where msg
is the object to be executed, returns a tmp
object to be passed to the after handler.
Socket close handler
.prom.on_pc hdl
Where hdl
is the handle of a socket connection, closes the socket.
Socket open handler
.prom.on_po hdl
Where hdl
is the handle of a socket connection, opens the socket.
Prometheus poll request handler
.prom.on_poll(requestText;requestHeaderAsDictionary)
Where (requestText;requestHeaderAsDictionary)
is an HTTP request