mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
monitoring: Add OpenMetrics exporter
This patch makes chasquid's monitoring server expose an OpenMetrics metrics endpoint. It adds a new package "expvarom" which implements an HTTP handler that exports expvar variables in the OpenMetrics text format. Then, the handler is registered by the monitoring server at /metrics (where most things expect it to be). The existing exported variables are also extended with descriptions, which is optional, but improves the readability of the metrics.
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"blitiri.com.ar/go/chasquid/internal/config"
|
||||
"blitiri.com.ar/go/chasquid/internal/courier"
|
||||
"blitiri.com.ar/go/chasquid/internal/dovecot"
|
||||
"blitiri.com.ar/go/chasquid/internal/expvarom"
|
||||
"blitiri.com.ar/go/chasquid/internal/maillog"
|
||||
"blitiri.com.ar/go/chasquid/internal/normalize"
|
||||
"blitiri.com.ar/go/chasquid/internal/smtpsrv"
|
||||
@@ -52,7 +53,8 @@ var (
|
||||
|
||||
sourceDate time.Time
|
||||
sourceDateVar = expvar.NewString("chasquid/sourceDateStr")
|
||||
sourceDateTsVar = expvar.NewInt("chasquid/sourceDateTimestamp")
|
||||
sourceDateTsVar = expvarom.NewInt("chasquid/sourceDateTimestamp",
|
||||
"timestamp when the binary was built, in seconds since epoch")
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user