metrics

package
v0.0.0-...-b5afeba Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyServer

type DummyServer struct {
}

DummyServer is a dummy metrics server

func NewDummyMetricsServer

func NewDummyMetricsServer(_ string) (server *DummyServer, err error)

NewDummyMetricsServer creates a new dummy metrics server

func (*DummyServer) ConsumeStats

func (s *DummyServer) ConsumeStats(_ string, _ *Stats) error

ConsumeStats for dummy metrics server does nothing

func (*DummyServer) Serve

func (s *DummyServer) Serve() error

Serve for DummyMetricsServer does nothing

func (*DummyServer) SetAlive

func (s *DummyServer) SetAlive()

SetAlive for dummy metrics server does nothing

func (*DummyServer) UpdateExporter

func (s *DummyServer) UpdateExporter()

UpdateExporter for dummy metrics server does nothing

type PrometheusMetricsServer

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

PrometheusMetricsServer contains the struct for the PrometheusMetricsServer

func NewMetricsServer

func NewMetricsServer(addr string) (server *PrometheusMetricsServer, err error)

NewMetricsServer creates a PrometheusMetricsServer

func (*PrometheusMetricsServer) ConsumeStats

func (s *PrometheusMetricsServer) ConsumeStats(category string, stats *Stats) error

ConsumeStats registers a Stats instance to be added to the prometheus metrics registry

func (*PrometheusMetricsServer) Serve

func (s *PrometheusMetricsServer) Serve() error

Serve sets up and starts the prometheus http server

func (*PrometheusMetricsServer) SetAlive

func (s *PrometheusMetricsServer) SetAlive()

SetAlive adds the alive metric into the metrics registry

func (*PrometheusMetricsServer) UpdateExporter

func (s *PrometheusMetricsServer) UpdateExporter()

UpdateExporter syncs the registered Stats instances to the metrics registry

type Stats

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

Stats implements dnsserver.stats.Stats. It also implements export.Int interface, allowing the counters to be exported. * NewStats to create it, * IncrementCounter increments the counter by 1 * IncrementCounterBy increments the counter by `value` * ResetCounter resets the counter to 0 * ResetCounterTo resets the counter to `value` * Get to export them.

func NewStats

func NewStats() *Stats

NewStats creates a new stats counter. The entity parameter specifies the ODS entity. If entity is the empty string, the ODS entity is inferred from the Tupperware task name, or the hostname if the process doesn't run in Tupperware.

func (*Stats) AddSample

func (stats *Stats) AddSample(key string, value int64)

AddSample adds a sample to the sliding window identified by key

func (*Stats) Get

func (stats *Stats) Get() map[string]int64

Get implements export.Int interface

func (*Stats) IncrementCounter

func (stats *Stats) IncrementCounter(key string)

IncrementCounter increments the counter for key by 1. Implements dnsserver.IncrementCounter interface.

func (*Stats) IncrementCounterBy

func (stats *Stats) IncrementCounterBy(key string, value int64)

IncrementCounterBy adds Value to the counter for key Implements dnsserver.IncrementCounterBy interface.

func (*Stats) ResetCounter

func (stats *Stats) ResetCounter(key string)

ResetCounter sets the counter for key to 0. Implements dnsserver.ResetCounter interface.

func (*Stats) ResetCounterTo

func (stats *Stats) ResetCounterTo(key string, value int64)

ResetCounterTo sets the counter for key to the given value. Implements dnsserver.ResetCounterTo interface.

Jump to

Keyboard shortcuts

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