Documentation ¶
Index ¶
- func Gauge(name string, val float32, labels ...metrics.Label)
- func GaugeLabels(name string, labels []metrics.Label, val float32)
- func Inc(name string, val int64, labels ...metrics.Label)
- func IncLabels(name string, labels []metrics.Label, val int64)
- func Init(serviceName string, conf Config) error
- func InitTags(serviceName string, conf Config, extraTags []string) error
- func InitWithSink(serviceName string, sink metrics.MetricSink) error
- func InitWithURL(serviceName string, endpoint string) (metrics.MetricSink, error)
- func L(name string, value string) metrics.Label
- func Labels(labels ...metrics.Label) []metrics.Label
- func MeasureSince(name string, start time.Time, labels ...metrics.Label)
- func MeasureSinceLabels(name string, labels []metrics.Label, start time.Time)
- func Sample(name string, val float32, labels ...metrics.Label)
- func SampleLabels(name string, labels []metrics.Label, val float32)
- type Config
- type DBStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gauge ¶
Gauge is used to report a single float32 value. It is most often used during a periodic update or timer to report the current size of a queue or how many connections are currently connected.
func GaugeLabels ¶
GaugeLabels is the same as Gauge but with additional labels
func IncLabels ¶
IncLabels increments a counter with additional labels
Example:
metriks.IncLabels("publisher.errors", metriks.Labels(metriks.L("status_class", "4xx")), 1)
func InitWithSink ¶
InitWithSink initializes the internal metrics system with custom sink
func InitWithURL ¶
InitWithURL will initialize using a URL to identify the sink type
Examples:
InitWithURL("api", "datadog://187.32.21.12:8125/?hostname=foo.com&tag=env:production") InitWithURL("api", "discard://nothing") InitWithURL("api", "inmem://discarded/?interval=10s&duration=30s")
func Labels ¶
func Labels(labels ...metrics.Label) []metrics.Label
Labels builds a dynamic list of labels
func MeasureSince ¶
MeasureSince records the time from start until the invocation of the function It is usually used with `defer` to record time of a function.
Example:
func getRows() ([]Row) { defer metriks.MeasureSince("publisher-get-rows.time", time.Now()) query := "SELECT * FROM publisher" return db.Execute(query) }
func MeasureSinceLabels ¶
MeasureSinceLabels is the same as MeasureSince, but with additional labels
func Sample ¶
Sample records a float32 sample as part of a histogram. This will get histogram distribution metrics
Example:
metriks.Sample("publisher-payload-size", float32(len(payload)))
func SampleLabels ¶
SampleLabels is the same as Sample but with additional labels