Documentation ¶
Index ¶
- Constants
- type PrometheusCounter
- type PrometheusCounterFunc
- type PrometheusCounterVec
- type PrometheusGauge
- type PrometheusGaugeFunc
- type PrometheusRegistererGatherer
- type PrometheusRepository
- func (r *PrometheusRepository) Count(name string, l observability.Labels) observability.Counter
- func (r *PrometheusRepository) CountFunc(name string, l observability.Labels) observability.CounterFunc
- func (r *PrometheusRepository) CountVec(name string, labelKeys ...string) observability.CounterVec
- func (r *PrometheusRepository) Gauge(name string, l observability.Labels) observability.Gauge
- func (r *PrometheusRepository) GaugeFunc(name string, l observability.Labels) observability.GaugeFunc
- func (r *PrometheusRepository) Handler() http.Handler
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 NewPrometheusCounter ¶
func NewPrometheusCounter(r prometheus.Registerer, name string, l observability.Labels) *PrometheusCounter
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 NewPrometheusCounterFunc ¶
func NewPrometheusCounterFunc(r prometheus.Registerer, name string, l observability.Labels) *PrometheusCounterFunc
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 NewPrometheusGauge ¶
func NewPrometheusGauge(r prometheus.Registerer, name string, l observability.Labels) *PrometheusGauge
func (PrometheusGauge) Set ¶
func (g PrometheusGauge) Set(f float64)
type PrometheusGaugeFunc ¶
type PrometheusGaugeFunc struct {
// contains filtered or unexported fields
}
func NewPrometheusGaugeFunc ¶
func NewPrometheusGaugeFunc(r prometheus.Registerer, name string, l observability.Labels) *PrometheusGaugeFunc
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 (r *PrometheusRepository) Count(name string, l observability.Labels) observability.Counter
func (*PrometheusRepository) CountFunc ¶
func (r *PrometheusRepository) CountFunc(name string, l observability.Labels) observability.CounterFunc
func (*PrometheusRepository) CountVec ¶
func (r *PrometheusRepository) CountVec(name string, labelKeys ...string) observability.CounterVec
func (*PrometheusRepository) Gauge ¶
func (r *PrometheusRepository) Gauge(name string, l observability.Labels) observability.Gauge
func (*PrometheusRepository) GaugeFunc ¶
func (r *PrometheusRepository) GaugeFunc(name string, l observability.Labels) observability.GaugeFunc
func (*PrometheusRepository) Handler ¶
func (r *PrometheusRepository) Handler() http.Handler
Click to show internal directories.
Click to hide internal directories.