metrics

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package metrics provides a metrics-tracking implementation for the service.

What to use and when:

Use Counters for counting things that always go up.
Use Gauges for things that can go up or down.
Use Histograms or Summaries for distributions of values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64CounterForTest

func Int64CounterForTest(name string) metric.Int64Counter

Types

type Float64Counter

type Float64Counter interface {
	Add(ctx context.Context, incr float64, options ...metric.AddOption)
}

type Float64CounterImpl

type Float64CounterImpl struct {
	X metric.Float64Counter
}

func (*Float64CounterImpl) Add

func (y *Float64CounterImpl) Add(ctx context.Context, incr float64, options ...metric.AddOption)

Add wraps the metric float64Counter interface.

type Float64Gauge

type Float64Gauge interface {
	Record(ctx context.Context, value float64, options ...metric.RecordOption)
}

type Float64GaugeImpl

type Float64GaugeImpl struct {
	X metric.Float64Gauge
}

func (*Float64GaugeImpl) Record

func (y *Float64GaugeImpl) Record(ctx context.Context, value float64, options ...metric.RecordOption)

Record wraps the metric float64Gauge interface.

type Float64Histogram

type Float64Histogram interface {
	Record(ctx context.Context, incr float64, options ...metric.RecordOption)
}

type Float64HistogramImpl

type Float64HistogramImpl struct {
	X metric.Float64Histogram
}

func (*Float64HistogramImpl) Record

func (y *Float64HistogramImpl) Record(ctx context.Context, incr float64, options ...metric.RecordOption)

Record wraps the metric float64Histogram interface.

type Float64UpDownCounter

type Float64UpDownCounter interface {
	Add(ctx context.Context, incr float64, options ...metric.AddOption)
}

type Float64UpDownCounterImpl

type Float64UpDownCounterImpl struct {
	X metric.Float64UpDownCounter
}

func (*Float64UpDownCounterImpl) Add

func (y *Float64UpDownCounterImpl) Add(ctx context.Context, incr float64, options ...metric.AddOption)

Add wraps the metric float64UpDownCounter interface.

type Int64Counter

type Int64Counter interface {
	Add(ctx context.Context, incr int64, options ...metric.AddOption)
}

type Int64CounterImpl

type Int64CounterImpl struct {
	X metric.Int64Counter
}

func (*Int64CounterImpl) Add

func (y *Int64CounterImpl) Add(ctx context.Context, incr int64, options ...metric.AddOption)

Add wraps the metric int64Counter interface.

type Int64Gauge

type Int64Gauge interface {
	Record(ctx context.Context, value int64, options ...metric.RecordOption)
}

type Int64GaugeImpl

type Int64GaugeImpl struct {
	X metric.Int64Gauge
}

func (*Int64GaugeImpl) Record

func (y *Int64GaugeImpl) Record(ctx context.Context, value int64, options ...metric.RecordOption)

Record wraps the metric int64Gauge interface.

type Int64Histogram

type Int64Histogram interface {
	Record(ctx context.Context, incr int64, options ...metric.RecordOption)
}

type Int64HistogramImpl

type Int64HistogramImpl struct {
	X metric.Int64Histogram
}

func (*Int64HistogramImpl) Record

func (y *Int64HistogramImpl) Record(ctx context.Context, incr int64, options ...metric.RecordOption)

Record wraps the metric int64Histogram interface.

type Int64UpDownCounter

type Int64UpDownCounter interface {
	Add(ctx context.Context, incr int64, options ...metric.AddOption)
}

type Int64UpDownCounterImpl

type Int64UpDownCounterImpl struct {
	X metric.Int64UpDownCounter
}

func (*Int64UpDownCounterImpl) Add

func (y *Int64UpDownCounterImpl) Add(ctx context.Context, incr int64, options ...metric.AddOption)

Add wraps the metric int64UpDownCounter interface.

type MockProvider

type MockProvider struct {
	mock.Mock
}

func (*MockProvider) MeterProvider

func (m *MockProvider) MeterProvider() metric.MeterProvider

MeterProvider satisfies our interface.

func (*MockProvider) NewFloat64Counter

func (m *MockProvider) NewFloat64Counter(name string, options ...metric.Float64CounterOption) (Float64Counter, error)

NewFloat64Counter satisfies our interface.

func (*MockProvider) NewFloat64Gauge

func (m *MockProvider) NewFloat64Gauge(name string, options ...metric.Float64GaugeOption) (Float64Gauge, error)

NewFloat64Gauge satisfies our interface.

func (*MockProvider) NewFloat64Histogram

func (m *MockProvider) NewFloat64Histogram(name string, options ...metric.Float64HistogramOption) (Float64Histogram, error)

NewFloat64Histogram satisfies our interface.

func (*MockProvider) NewFloat64UpDownCounter

func (m *MockProvider) NewFloat64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (Float64UpDownCounter, error)

NewFloat64UpDownCounter satisfies our interface.

func (*MockProvider) NewInt64Counter

func (m *MockProvider) NewInt64Counter(name string, options ...metric.Int64CounterOption) (Int64Counter, error)

NewInt64Counter satisfies our interface.

func (*MockProvider) NewInt64Gauge

func (m *MockProvider) NewInt64Gauge(name string, options ...metric.Int64GaugeOption) (Int64Gauge, error)

NewInt64Gauge satisfies our interface.

func (*MockProvider) NewInt64Histogram

func (m *MockProvider) NewInt64Histogram(name string, options ...metric.Int64HistogramOption) (Int64Histogram, error)

NewInt64Histogram satisfies our interface.

func (*MockProvider) NewInt64UpDownCounter

func (m *MockProvider) NewInt64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (Int64UpDownCounter, error)

NewInt64UpDownCounter satisfies our interface.

func (*MockProvider) Shutdown

func (m *MockProvider) Shutdown(ctx context.Context) error

Shutdown satisfies our interface.

type Provider

type Provider interface {
	NewFloat64Counter(name string, options ...metric.Float64CounterOption) (Float64Counter, error)
	NewFloat64Gauge(name string, options ...metric.Float64GaugeOption) (Float64Gauge, error)
	NewFloat64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (Float64UpDownCounter, error)
	NewFloat64Histogram(name string, options ...metric.Float64HistogramOption) (Float64Histogram, error)
	NewInt64Counter(name string, options ...metric.Int64CounterOption) (Int64Counter, error)
	NewInt64Gauge(name string, options ...metric.Int64GaugeOption) (Int64Gauge, error)
	NewInt64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (Int64UpDownCounter, error)
	NewInt64Histogram(name string, options ...metric.Int64HistogramOption) (Int64Histogram, error)
	Shutdown(ctx context.Context) error
	MeterProvider() metric.MeterProvider
}

func EnsureMetricsProvider

func EnsureMetricsProvider(mp Provider) Provider

func NewNoopMetricsProvider

func NewNoopMetricsProvider() Provider

Directories

Path Synopsis
Package mockmetrics provides metrics-related mocks.
Package mockmetrics provides metrics-related mocks.

Jump to

Keyboard shortcuts

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