zapx: go.bobheadxi.dev/zapx/zmetrics Index | Files

package zmetrics

import "go.bobheadxi.dev/zapx/zmetrics"

Package zmetrics (EXPERIMENTAL) provides a zap logger that can report metrics based on field names and field values.

TODO: examples

Index

Package Files

collector.go doc.go metrics.go values.go

func IncrementValue Uses

func IncrementValue(zapcore.Field) float64

IncrementValue returns 1 when a field is encountered

func NumericalValue Uses

func NumericalValue(f zapcore.Field) float64

NumericalValue returns the numerical value of the field. It supports most basic numeric types such as Duration, Floats, and signed/unsigned integers.

func UnixNanoTimeValue Uses

func UnixNanoTimeValue(f zapcore.Field) float64

UnixNanoTimeValue returns the unix nanosecond value of a time field.

func UnixTimeValue Uses

func UnixTimeValue(f zapcore.Field) float64

UnixTimeValue returns the unix value of a time field.

func WithCollectors Uses

func WithCollectors(l *zap.Logger, collectors Collectors) *zap.Logger

WithCollectors attaches collectors to the logger

type Collectors Uses

type Collectors struct {
    Histograms map[string]HistogramCollector
    Counters   map[string]CounterCollector
    Gauges     map[string]GaugeCollector
}

Collectors is a container for all your metrics collectors

type Counter Uses

type Counter interface{ Add(delta float64) }

Counter describes a metric that accumulates values monotonically.

type CounterCollector Uses

type CounterCollector struct {
    Counter
    Value ValueFunc
}

CounterCollector defines a collector for counters

type Gauge Uses

type Gauge interface{ Set(value float64) }

Gauge describes a metric that takes specific values over time.

type GaugeCollector Uses

type GaugeCollector struct {
    Gauge
    Value ValueFunc
}

GaugeCollector defines a collector for gauges

type Histogram Uses

type Histogram interface{ Observe(value float64) }

Histogram describes a metric that takes repeated observations of the same kind of thing, and produces a statistical summary of those observations, typically expressed as quantiles or buckets.

type HistogramCollector Uses

type HistogramCollector struct {
    Histogram
    Value ValueFunc
}

HistogramCollector defines a collector for histograms

type ValueFunc Uses

type ValueFunc func(zapcore.Field) float64

ValueFunc returns the value associated with a field

Package zmetrics imports 4 packages (graph). Updated 2019-08-23. Refresh now. Tools for package owners.