Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Engine ¶
func Engine(e *gin.Engine) func(*Prometheus)
Engine is an option allowing to set the gin engine when intializing with New. Example : r := gin.Default() p := ginprom.New(Engine(r))
func Ignore ¶
func Ignore(paths ...string) func(*Prometheus)
Ignore is used to disable instrumentation on some routes
func Namespace ¶ added in v1.1.2
func Namespace(ns string) func(*Prometheus)
Namespace is an option allowing to set the namespace when intitializing with New. Example : ginprom.New(ginprom.Namespace("my_namespace"))
func Path ¶
func Path(path string) func(*Prometheus)
Path is an option allowing to set the metrics path when intializing with New. Example : ginprom.New(ginprom.Path("/mymetrics"))
func Subsystem ¶
func Subsystem(sub string) func(*Prometheus)
Subsystem is an option allowing to set the subsystem when intitializing with New. Example : ginprom.New(ginprom.Subsystem("my_system"))
Types ¶
type Prometheus ¶
type Prometheus struct { MetricsPath string Namespace string Subsystem string Ignored pmapb Engine *gin.Engine PathMap pmap // contains filtered or unexported fields }
Prometheus contains the metrics gathered by the instance and its path
func New ¶
func New(options ...func(*Prometheus)) *Prometheus
New will initialize a new Prometheus instance with the given options. If no options are passed, sane defaults are used. If a router is passed using the Engine() option, this instance will automatically bind to it.
func (*Prometheus) Instrument ¶
func (p *Prometheus) Instrument() gin.HandlerFunc
Instrument is a gin middleware that can be used to generate metrics for a single handler
func (*Prometheus) Use ¶
func (p *Prometheus) Use(e *gin.Engine)
Use is a method that should be used if the engine is set after middleware initialization