Documentation ¶
Index ¶
- type DummyServer
- type PrometheusMetricsServer
- type Stats
- func (stats *Stats) AddSample(key string, value int64)
- func (stats *Stats) Get() map[string]int64
- func (stats *Stats) IncrementCounter(key string)
- func (stats *Stats) IncrementCounterBy(key string, value int64)
- func (stats *Stats) ResetCounter(key string)
- func (stats *Stats) ResetCounterTo(key string, value int64)
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) IncrementCounter ¶
IncrementCounter increments the counter for key by 1. Implements dnsserver.IncrementCounter interface.
func (*Stats) IncrementCounterBy ¶
IncrementCounterBy adds Value to the counter for key Implements dnsserver.IncrementCounterBy interface.
func (*Stats) ResetCounter ¶
ResetCounter sets the counter for key to 0. Implements dnsserver.ResetCounter interface.
func (*Stats) ResetCounterTo ¶
ResetCounterTo sets the counter for key to the given value. Implements dnsserver.ResetCounterTo interface.