Documentation ¶
Overview ¶
Package promwish provides a simple middleware to expose some metrics to Prometheus.
Index ¶
- func DefaultCommandFn(s ssh.Session) string
- func Listen(address string)
- func Middleware(address, app string) wish.Middleware
- func MiddlewareRegistry(registry prometheus.Registerer, constLabels prometheus.Labels, fn CommandFn) wish.Middleware
- func MiddlewareWithCommand(address, app string, fn CommandFn) wish.Middleware
- type CommandFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCommandFn ¶ added in v0.4.0
DefaultCommandFn is a CommandFn that returns the first part of s.Command().
func Listen ¶
func Listen(address string)
Listen starts a HTTP server on the given address, serving the metrics from the default registerer to /metrics. It handles exit signals to gracefully shutdown the server.
func Middleware ¶
func Middleware(address, app string) wish.Middleware
Middleware starts a HTTP server on the given address, serving the metrics from the default registerer to /metrics.
func MiddlewareRegistry ¶
func MiddlewareRegistry(registry prometheus.Registerer, constLabels prometheus.Labels, fn CommandFn) wish.Middleware
Middleware setup the metrics for the given registry without starting any HTTP servers. The caller is then responsible for serving the metrics.
func MiddlewareWithCommand ¶ added in v0.4.0
func MiddlewareWithCommand(address, app string, fn CommandFn) wish.Middleware
MiddlewareWithCommand() starts a HTTP server on the given address, serving the metrics from the default registerer to /metrics, using the given CommandFn to extract the `command` label value.