Documentation ¶
Overview ¶
Package metrics defines a common interface for instrumenting applications and components to collect metrics.
Index ¶
- type Client
- type Default
- func (c *Default) Close() error
- func (c *Default) IncErrorCounter(_, _, _ string)
- func (c *Default) IncLogLevelCounter(_ string)
- func (c *Default) InstrumentDB(_ string, _ *sql.DB) error
- func (c *Default) InstrumentHandler(_ string, handler http.HandlerFunc) http.Handler
- func (c *Default) InstrumentRoundTripper(next http.RoundTripper) http.RoundTripper
- func (c *Default) MetricsHandlerFunc() http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // InstrumentDB wraps a sql.DB to collect metrics. InstrumentDB(dbName string, db *sql.DB) error // InstrumentHandler wraps a http.Handler to collect metrics. InstrumentHandler(path string, handler http.HandlerFunc) http.Handler // InstrumentRoundTripper is a middleware that wraps the provided http.RoundTripper to observe the request result with default metrics. InstrumentRoundTripper(next http.RoundTripper) http.RoundTripper // MetricsHandlerFunc returns an http handler function to serve the metrics endpoint. MetricsHandlerFunc() http.HandlerFunc // IncLogLevelCounter counts the number of errors for each log severity level. IncLogLevelCounter(level string) // IncErrorCounter increments the number of errors by task, operation and error code. IncErrorCounter(task, operation, code string) // Close method. Close() error }
Client is an interface type for the metrics functions.
type Default ¶
type Default struct{}
Default is the default implementation for the Client interface.
func (*Default) IncErrorCounter ¶
IncErrorCounter is an empty function.
func (*Default) IncLogLevelCounter ¶
IncLogLevelCounter is an empty function.
func (*Default) InstrumentDB ¶
InstrumentDB wraps a sql.DB to collect metrics.
func (*Default) InstrumentHandler ¶
InstrumentHandler returns the input handler.
func (*Default) InstrumentRoundTripper ¶
func (c *Default) InstrumentRoundTripper(next http.RoundTripper) http.RoundTripper
InstrumentRoundTripper returns the input Roundtripper.
func (*Default) MetricsHandlerFunc ¶
func (c *Default) MetricsHandlerFunc() http.HandlerFunc
MetricsHandlerFunc returns an http handler function.
Directories ¶
Path | Synopsis |
---|---|
Package prometheus implements the metrics interface for Prometheus.
|
Package prometheus implements the metrics interface for Prometheus. |
Package statsd implements the metrics interface for StatsD.
|
Package statsd implements the metrics interface for StatsD. |
Click to show internal directories.
Click to hide internal directories.