tulip.pkg.metrics module exports the
- allowed_metrics: array of string = if set, only those metrics
will be allowed.
- host: string = the address of the statsd-compatible UDP server to send
- port: number = the port of the statsd-compatible UDP server to send
- write_timeout: number = write timeout of metrics in seconds.
[w]middleware.timer.name: string = the name of the counter/timer metrics
to record in the [w]middleware.
[w]middleware.timer.sample: number = the sample rate of the counter/timer
If there is no [w]middleware.counter or [w]middleware.timer config, then that
metric is not recorded, and if there is no [w]middleware table, then the
[w]middleware is not registered.
Registering this package provides the following method and field extensions.
ok, err = App:metrics(name, type[, value[, t]])
Reports a metric to the configured UDP server, in the statsd protocol.
- name: string = name of the metric
- type: string = 'counter', 'gauge', 'timer' or 'set'.
- value: number|nil = the value to register, defaults to 1.
- t: table|nil = a dictionary of key-value strings to register
as dimensions (labels, tags) associated with the sample. If the
table has an ['@'] field, its value is the sampling rate of the
metric. Tags are added in the Librato style, see
- ok: boolean = true on success
- err: Error|nil = error message if ok is falsy
The following middleware are registered and can be referenced by name in the configuration.
Records web metrics based on the configuration. If a counter is configured,
records the request count. If a timer is configured, records the request
duration. The path, method and status code are recorded as labels.
The following wmiddleware (worker middleware) are registered and can be referenced by name in the configuration.
Records worker metrics based on the configuration. If a counter is configured,
records the messages count. If a timer is configured, records the message
processing duration. The queue name is recorded as label.
Back to index