Documentation ¶
Index ¶
- type Controller
- func (mws *Controller) CreateCounterVecWithCallback(name string, help string, variableLabels []string, subItems VectorMetric) error
- func (mws *Controller) CreateCounterWithCallback(name string, help string, handler ValueHandler) error
- func (mws *Controller) CreateGaugeVecWithCallback(name string, help string, variableLabels []string, subItems VectorMetric) error
- func (mws *Controller) CreateGaugeWithCallback(name string, help string, handler ValueHandler) error
- func (mws *Controller) Destroy()
- func (mws *Controller) Registry() *prometheus.Registry
- func (mws *Controller) Start() error
- type HealthCallback
- type Options
- type ValueHandler
- type VectorMetric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶ added in v1.1.0
type Controller struct {
// contains filtered or unexported fields
}
Controller holds details about a metrics monitor instance.
func CreateController ¶ added in v1.1.0
func CreateController(options Options) (*Controller, error)
CreateController initializes and creates a new controller
func (*Controller) CreateCounterVecWithCallback ¶ added in v1.1.0
func (mws *Controller) CreateCounterVecWithCallback( name string, help string, variableLabels []string, subItems VectorMetric, ) error
CreateCounterVecWithCallback creates a vector of counters metric where their data are populated by calling a callback
func (*Controller) CreateCounterWithCallback ¶ added in v1.1.0
func (mws *Controller) CreateCounterWithCallback(name string, help string, handler ValueHandler) error
CreateCounterWithCallback creates a single counter metric where its data is populated by calling a callback
func (*Controller) CreateGaugeVecWithCallback ¶ added in v1.1.0
func (mws *Controller) CreateGaugeVecWithCallback( name string, help string, variableLabels []string, subItems VectorMetric, ) error
CreateGaugeVecWithCallback creates a vector of gauges metric where their data are populated by calling a callback
func (*Controller) CreateGaugeWithCallback ¶ added in v1.1.0
func (mws *Controller) CreateGaugeWithCallback(name string, help string, handler ValueHandler) error
CreateGaugeWithCallback creates a single gauge metric where its data is populated by calling a callback
func (*Controller) Destroy ¶ added in v1.1.0
func (mws *Controller) Destroy()
Destroy destroys the monitor and stops the internal web server
func (*Controller) Registry ¶ added in v1.1.0
func (mws *Controller) Registry() *prometheus.Registry
Registry returns the prometheus registry object
func (*Controller) Start ¶ added in v1.1.0
func (mws *Controller) Start() error
Start starts the monitor's internal web server
type HealthCallback ¶
type HealthCallback func() string
HealthCallback indicates a function that returns a string that will be returned as the output.
type Options ¶
type Options struct { // If Server is provided, use this server instead of creating a new one. Server *webserver.Server // Server name to use when sending response headers. Defaults to 'metrics-server'. Name string // Address is the bind address to attach the internal web server. Address string // Port is the port number the internal web server will use. Port uint16 // TLSConfig optionally provides a TLS configuration for use. TLSConfig *tls.Config // A callback to call if an error is encountered. ListenErrorHandler webserver.ListenErrorHandler // AccessToken is an optional access token required to access the status endpoints. AccessToken string // If RequestAccessTokenInHealth is enabled, access token checked also in '/health' endpoint. RequestAccessTokenInHealth bool // HealthCallback is a function that returns an object which, in turn, will be converted to JSON format. HealthCallback HealthCallback // Expose debugging profiles /debug/pprof endpoint. EnableDebugProfiles bool // Include Cache-Control headers in response to disable client-side caching. DisableClientCache bool // Include CORS headers in response. IncludeCORS bool // Middlewares additional set of middlewares for the endpoints. Middlewares []webserver.MiddlewareFunc }
Options specifies metrics controller initialization options.
type ValueHandler ¶
type ValueHandler func() float64
type VectorMetric ¶
type VectorMetric []struct { Values []string Handler ValueHandler }