Documentation ¶
Index ¶
- func RegistGin(subsystem string, e *gin.Engine) error
- func RegistGinWithRouter(subsystem string, e *gin.Engine, metricsPath string) error
- func RegistGinWithRouterAuth(subsystem string, e *gin.Engine, metricspath string, accounts gin.Accounts) error
- type ProbeInfo
- type RequestCounterURLLabelMappingFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegistGin ¶
RegistGin adds the middleware to a gin engine.(without use engine as a metrics server)
func RegistGinWithRouter ¶
RegistGinWithRouter adds the middleware and metrics path to a gin engine.
Types ¶
type ProbeInfo ¶
type ProbeInfo struct { ServiceName string Host string Version string ProbePath string VersionPath string Uptime time.Time }
ProbeInfo store the info expored in probe url
func NewProbeInfo ¶
NewProbeInfo generates a new set of ProbeInfo with a certain subsystem name
func (*ProbeInfo) RegistPath ¶
RegistPath regist Probe/Version paths to gin
func (*ProbeInfo) SetProbePath ¶
SetProbePath set Probe path
func (*ProbeInfo) SetVersionPath ¶
SetVersionPath set Probe path
type RequestCounterURLLabelMappingFn ¶
RequestCounterURLLabelMappingFn is a function which can be supplied to the middleware to control the cardinality of the request counter's "url" label, which might be required in some contexts. For instance, if for a "/customer/:name" route you don't want to generate a time series for every possible customer name, you could use this function:
func(c *gin.Context) string { url := c.Request.URL.Path for _, p := range c.Params { if p.Key == "name" { url = strings.Replace(url, p.Value, ":name", 1) break } } return url }
which would map "/customer/alice" and "/customer/bob" to their template "/customer/:name".