simplemetrics

package
v0.0.0-...-183aff7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractFields

type AbstractFields = field.AbstractFields

AbstractFields is just a type-alias for field.AbstractFields (for convenience).

type Count

type Count struct {
	atomic.Uint64
	// contains filtered or unexported fields
}

Count is a naive implementation of Count.

func (*Count) Add

func (metric *Count) Add(add uint64) types.Count

Add implements metrics.Count.

func (*Count) Value

func (metric *Count) Value() any

Value implements metrics.Count.

func (*Count) WithResetFields

func (metric *Count) WithResetFields(fields AbstractFields) types.Count

WithResetFields implements Count.

type Field

type Field = field.Field

Field is just a type-alias for field.Field (for convenience).

type FieldsChain

type FieldsChain = field.FieldsChain

FieldsChain is just a type-alias for field.FieldsChain (for convenience).

type Gauge

type Gauge struct {
	Family *gaugeFamily
	atomic.Float64
}

Gauge is a naive implementation of Gauge.

func (*Gauge) Add

func (metric *Gauge) Add(add float64) types.Gauge

Add implements metrics.Gauge.

func (*Gauge) Value

func (metric *Gauge) Value() any

Value implements metrics.Gauge.

func (*Gauge) WithResetFields

func (metric *Gauge) WithResetFields(fields AbstractFields) types.Gauge

WithResetFields implements Gauge.

type IntGauge

type IntGauge struct {
	Family *intGaugeFamily
	atomic.Int64
}

IntGauge is a naive implementation of IntGauge.

func (*IntGauge) Add

func (metric *IntGauge) Add(add int64) types.IntGauge

Add implements metrics.IntGauge.

func (*IntGauge) Value

func (metric *IntGauge) Value() any

Value implements metrics.IntGauge.

func (*IntGauge) WithResetFields

func (metric *IntGauge) WithResetFields(fields AbstractFields) types.IntGauge

WithResetFields implements IntGauge.

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics is a naive implementation of Metrics

func New

func New() *Metrics

New returns an instance of Metrics.

func (*Metrics) Count

func (metrics *Metrics) Count(key string) types.Count

Count implements metrics.Metrics.

func (*Metrics) CountFields

func (metrics *Metrics) CountFields(key string, additionalFields AbstractFields) types.Count

CountFields implements metrics.Metrics.

func (*Metrics) Flush

func (*Metrics) Flush()

Flush implements metrics.Metrics (or more specifically belt.Tool).

func (*Metrics) ForEachCount

func (metrics *Metrics) ForEachCount(callback func(types.Count) bool) bool

ForEachCount iterates through all Count metrics. Stops at first `false` returned by the callback function.

func (*Metrics) ForEachGauge

func (metrics *Metrics) ForEachGauge(callback func(types.Gauge) bool) bool

ForEachGauge iterates through all Gauge metrics. Stops at first `false` returned by the callback function.

func (*Metrics) ForEachIntGauge

func (metrics *Metrics) ForEachIntGauge(callback func(types.IntGauge) bool) bool

ForEachIntGauge iterates through all IntGauge metrics. Stops at first `false` returned by the callback function.

func (*Metrics) Gauge

func (metrics *Metrics) Gauge(key string) types.Gauge

Gauge implements metrics.Metrics.

func (*Metrics) GaugeFields

func (metrics *Metrics) GaugeFields(key string, additionalFields AbstractFields) types.Gauge

GaugeFields implements metrics.Metrics.

func (*Metrics) IntGauge

func (metrics *Metrics) IntGauge(key string) types.IntGauge

IntGauge implements metrics.Metrics.

func (*Metrics) IntGaugeFields

func (metrics *Metrics) IntGaugeFields(key string, additionalFields AbstractFields) types.IntGauge

IntGaugeFields implements metrics.Metrics.

func (Metrics) WithContextFields

func (metrics Metrics) WithContextFields(allFields *FieldsChain, newFieldsCount int) Tool

WithContextFields implements metrics.Metrics.

func (*Metrics) WithTraceIDs

func (metrics *Metrics) WithTraceIDs(traceIDs TraceIDs, newTraceIDsCount int) Tool

WithTraceIDs implements metrics.Metrics.

type Tool

type Tool = belt.Tool

Tool is just a type-alias for belt.Tool (for convenience).

type TraceID

type TraceID = belt.TraceID

TraceID is just a type-alias for belt.TraceID (for convenience).

type TraceIDs

type TraceIDs = belt.TraceIDs

TraceIDs is just a type-alias for belt.TraceIDs (for convenience).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL