Versions in this module Expand all Collapse all v0 v0.0.2 Aug 27, 2024 Changes in this version type Metrics + func (s Metrics) Len() int v0.0.1 Feb 21, 2024 Changes in this version + const HeaderSize + func NewSpackEncoder(ctx context.Context, compression CompressionType, metrics *Metrics, ...) *spackEncoder + func Rated(s interface{}) + func WithTags(tags map[string]string) func(*MetricsOpts) + func WithTimestamp(t time.Time) func(*MetricsOpts) + func WithUseNameTag() func(*MetricsOpts) + func WithVersion12() func(*spackEncoder) + type CompressionType uint8 + const CompressionLz4 + const CompressionNone + const CompressionZlib + const CompressionZstd + type Counter struct + func (c *Counter) Add(delta int64) + func (c *Counter) Inc() + func (c *Counter) MarshalJSON() ([]byte, error) + func (c *Counter) Name() string + func (c *Counter) Snapshot() Metric + type CounterVec struct + func (v *CounterVec) Reset() + func (v *CounterVec) With(tags map[string]string) metrics.Counter + type DurationHistogramVec struct + func (v *DurationHistogramVec) Reset() + func (v *DurationHistogramVec) With(tags map[string]string) metrics.Timer + type FuncCounter struct + func (c *FuncCounter) Function() func() int64 + func (c *FuncCounter) MarshalJSON() ([]byte, error) + func (c *FuncCounter) Name() string + func (c *FuncCounter) Snapshot() Metric + type FuncGauge struct + func (g *FuncGauge) Function() func() float64 + func (g *FuncGauge) MarshalJSON() ([]byte, error) + func (g *FuncGauge) Name() string + func (g *FuncGauge) Snapshot() Metric + type FuncIntGauge struct + func (g *FuncIntGauge) Function() func() int64 + func (g *FuncIntGauge) MarshalJSON() ([]byte, error) + func (g *FuncIntGauge) Name() string + func (g *FuncIntGauge) Snapshot() Metric + type Gauge struct + func NewGauge(name string, value float64, opts ...MetricOpt) Gauge + func (g *Gauge) Add(value float64) + func (g *Gauge) MarshalJSON() ([]byte, error) + func (g *Gauge) Name() string + func (g *Gauge) Set(value float64) + func (g *Gauge) Snapshot() Metric + type GaugeVec struct + func (v *GaugeVec) Reset() + func (v *GaugeVec) With(tags map[string]string) metrics.Gauge + type Histogram struct + func (h *Histogram) InitBucketValues(bucketValues []int64) + func (h *Histogram) MarshalJSON() ([]byte, error) + func (h *Histogram) Name() string + func (h *Histogram) RecordDuration(value time.Duration) + func (h *Histogram) RecordValue(value float64) + func (h *Histogram) Reset() + func (h *Histogram) Snapshot() Metric + type HistogramVec struct + func (v *HistogramVec) Reset() + func (v *HistogramVec) With(tags map[string]string) metrics.Histogram + type IntGauge struct + func NewIntGauge(name string, value int64, opts ...MetricOpt) IntGauge + func (g *IntGauge) Add(value int64) + func (g *IntGauge) MarshalJSON() ([]byte, error) + func (g *IntGauge) Name() string + func (g *IntGauge) Set(value int64) + func (g *IntGauge) Snapshot() Metric + type IntGaugeVec struct + func (v *IntGaugeVec) Reset() + func (v *IntGaugeVec) With(tags map[string]string) metrics.IntGauge + type Metric interface + Name func() string + Snapshot func() Metric + type MetricOpt func(*MetricsOpts) + type Metrics struct + func NewMetrics(metrics []Metric) Metrics + func NewMetricsWithTimestamp(metrics []Metric, ts time.Time) Metrics + func PrometheusMetrics(metrics []*dto.MetricFamily) (*Metrics, error) + func (s Metrics) List() []Metric + func (s Metrics) MarshalBinary() ([]byte, error) + func (s Metrics) MarshalJSON() ([]byte, error) + func (s Metrics) SplitToChunks(maxChunkSize int) []Metrics + type MetricsOpts struct + type Registry struct + func NewRegistry(opts *RegistryOpts) *Registry + func (r *Registry) CounterVec(name string, labels []string) metrics.CounterVec + func (r *Registry) DurationHistogramVec(name string, buckets metrics.DurationBuckets, labels []string) metrics.TimerVec + func (r *Registry) GaugeVec(name string, labels []string) metrics.GaugeVec + func (r *Registry) HistogramVec(name string, buckets metrics.Buckets, labels []string) metrics.HistogramVec + func (r *Registry) IntGaugeVec(name string, labels []string) metrics.IntGaugeVec + func (r *Registry) Stream(ctx context.Context, w io.Writer) (written int, err error) + func (r *Registry) StreamJSON(ctx context.Context, w io.Writer) (written int, err error) + func (r *Registry) StreamSpack(ctx context.Context, w io.Writer, compression CompressionType) (int, error) + func (r *Registry) TimerVec(name string, labels []string) metrics.TimerVec + func (r Registry) ComposeName(parts ...string) string + func (r Registry) Counter(name string) metrics.Counter + func (r Registry) DurationHistogram(name string, buckets metrics.DurationBuckets) metrics.Timer + func (r Registry) FuncCounter(name string, function func() int64) metrics.FuncCounter + func (r Registry) FuncGauge(name string, function func() float64) metrics.FuncGauge + func (r Registry) FuncIntGauge(name string, function func() int64) metrics.FuncIntGauge + func (r Registry) Gather() (*Metrics, error) + func (r Registry) Gauge(name string) metrics.Gauge + func (r Registry) Histogram(name string, buckets metrics.Buckets) metrics.Histogram + func (r Registry) IntGauge(name string) metrics.IntGauge + func (r Registry) Rated(rated bool) metrics.Registry + func (r Registry) RemoveMetric(name string) + func (r Registry) Timer(name string) metrics.Timer + func (r Registry) WithPrefix(prefix string) metrics.Registry + func (r Registry) WithTags(tags map[string]string) metrics.Registry + type RegistryOpts struct + Collectors []func(metrics.Registry) + Prefix string + Rated bool + Separator rune + StreamFormat StreamFormat + Tags map[string]string + UseNameTag bool + func NewRegistryOpts() *RegistryOpts + func (o *RegistryOpts) AddCollectors(ctx context.Context, c metrics.CollectPolicy, collectors ...collect.Func) *RegistryOpts + func (o *RegistryOpts) AddTags(tags map[string]string) *RegistryOpts + func (o *RegistryOpts) AppendPrefix(prefix string) *RegistryOpts + func (o *RegistryOpts) SetPrefix(prefix string) *RegistryOpts + func (o *RegistryOpts) SetRated(rated bool) *RegistryOpts + func (o *RegistryOpts) SetSeparator(separator rune) *RegistryOpts + func (o *RegistryOpts) SetStreamFormat(format StreamFormat) *RegistryOpts + func (o *RegistryOpts) SetTags(tags map[string]string) *RegistryOpts + func (o *RegistryOpts) SetUseNameTag(useNameTag bool) *RegistryOpts + type SpackOpts func(*spackEncoder) + type StreamFormat string + const StreamJSON + const StreamSpack + type Timer struct + func (t *Timer) MarshalJSON() ([]byte, error) + func (t *Timer) Name() string + func (t *Timer) RecordDuration(value time.Duration) + func (t *Timer) Snapshot() Metric + type TimerVec struct + func (v *TimerVec) Reset() + func (v *TimerVec) With(tags map[string]string) metrics.Timer