metrics

package
v0.0.0-...-edc748c Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricNamespace = "openspa"
	MetricSubsystem = "server"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PrometheusCounter

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

func (PrometheusCounter) Add

func (c PrometheusCounter) Add(count int)

func (PrometheusCounter) Get

func (c PrometheusCounter) Get() int

func (PrometheusCounter) Inc

func (c PrometheusCounter) Inc()

type PrometheusCounterFunc

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

func (*PrometheusCounterFunc) CounterFuncDeregister

func (cf *PrometheusCounterFunc) CounterFuncDeregister()

func (*PrometheusCounterFunc) CounterFuncRegister

func (cf *PrometheusCounterFunc) CounterFuncRegister(fn func() float64)

type PrometheusCounterVec

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

func NewPrometheusCounterVec

func NewPrometheusCounterVec(r prometheus.Registerer, name string, labelKeys ...string) *PrometheusCounterVec

func (*PrometheusCounterVec) Add

func (c *PrometheusCounterVec) Add(count int, labelValues ...string)

func (*PrometheusCounterVec) Inc

func (c *PrometheusCounterVec) Inc(labelValues ...string)

type PrometheusGauge

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

func (PrometheusGauge) Set

func (g PrometheusGauge) Set(f float64)

type PrometheusGaugeFunc

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

func (*PrometheusGaugeFunc) GaugeFuncDeregister

func (cf *PrometheusGaugeFunc) GaugeFuncDeregister()

func (*PrometheusGaugeFunc) GaugeFuncRegister

func (cf *PrometheusGaugeFunc) GaugeFuncRegister(fn func() float64)

type PrometheusRegistererGatherer

type PrometheusRegistererGatherer interface {
	prometheus.Registerer
	prometheus.Gatherer
}

type PrometheusRepository

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

PrometheusRepository implements the observability.MetricsRepository interface. Counter implementation

Pros:
- Fast (benchmarks on development machines not end customer hardware!) shows approx. 9ns per Inc() operation
  if the returned Counter implementation is stored instead of calling Counter() each time.
Cons:
- Requires you to store each metric label variant

CounterVec implementation

Pros:
- Can save a single variable for all metric label values (since we initialize only the label keys)
Cons:
- Slower than Counter (benchmarks on development machine) shows approx. 94ns per Inc() operation if the returned
  CounterVec implementation is stored instead of calling CounterVec() each time.

CounterFunc implementation

Pros:
- Value can be calculated externally
Cons:
- Requires a callback to be registered (and deregistered)

func NewPrometheusRepository

func NewPrometheusRepository(withRuntimeCollector bool) *PrometheusRepository

func NewPrometheusRepositoryCustomRegistry

func NewPrometheusRepositoryCustomRegistry(reg PrometheusRegistererGatherer) *PrometheusRepository

func (*PrometheusRepository) Count

func (*PrometheusRepository) CountFunc

func (*PrometheusRepository) CountVec

func (r *PrometheusRepository) CountVec(name string, labelKeys ...string) observability.CounterVec

func (*PrometheusRepository) Gauge

func (*PrometheusRepository) GaugeFunc

func (*PrometheusRepository) Handler

func (r *PrometheusRepository) Handler() http.Handler

Jump to

Keyboard shortcuts

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