Tested on SBCL and CCL.
Example Grafana dashboard for Hunchentoot on SBCL:
You can get this dashboard here.
Example uses the Linux process collector, plus the SBCL collectors on SBCL.
(ql:quickload :prometheus.examples)
(prometheus.example:run)You can override app/exporter host/port in prometheus.example:run arguments. To stop example app call prometheus.example:stop
- Counter
- Int Counter (can only work with unsigned int64)
- Gauge
- Histogram
- Simple Summary (without quantiles)
- Summary (with quantiles, CKMS via quantile-estimator)
- Quantile Summary (DDSketch: relative-error quantiles, mergeable across series, sharded per CPU; port of prometheus.erl's
prometheus_quantile_summary)
- Threads
- Memory
- Open fds count
- Max fds count
- Virtual memory bytes
- Resident memory bytes
- Process CPU seconds{stime|utime} (total)
- Process start time (Unix epoch)
- Process uptime
Linux? only
Hot paths allocate nothing and use no CLOS. Resolve a series once and keep it - this skips the label lookup:
(defvar *requests* (prom:get-metric requests-counter '("get")))
(prom:counter.inc *requests*)Counters, histograms and quantile summaries are sharded per CPU, so threads on different CPUs do not contend. Label lookups are lock-free.
SBCL 2.6.10, 4 CPUs, 32 threads, million ops/s:
| 0.4 | now | |
|---|---|---|
counter.inc on a series |
4.2 | 55.6 |
counter.inc with labels |
1.6 | 26.3 |
gauge.set on a series, 1 thread, ns/op |
59.6 | 8.0 |
histogram.observe on a series |
2.5 | 50.0 |
| summary observe (CKMS -> DDSketch) | 0.3 | 19.2 |
Hunchentoot exposer plus SBCL metrics.
(prom.sbcl:make-memory-collector)
(prom.sbcl:make-threads-collector)
(defclass my-acceptor (prom.tbnl::hunchentoot-exposer tbnl:acceptor)
())
(tbnl:start (make-instance 'my-acceptor :address "172.17.0.1" :port 9101))will produce something like this:
Effect of (sb-ext:gc) can be seen clearly.
MIT

