Documentation
¶
Index ¶
- type Counter
- type Epimetheus
- func (e *Epimetheus) Listen() *Server
- func (e *Epimetheus) NewCounter(name string, labelNames []string) *Counter
- func (e *Epimetheus) NewGauge(name string, labelNames []string) *Gauge
- func (e *Epimetheus) NewTimer(name string, labelNames []string) *Timer
- func (e *Epimetheus) NewTimerWithCounter(name string, labelNames []string) *TimerWithCounter
- type Gauge
- type Server
- type StaticCounter
- type StaticGauge
- type Timer
- type TimerWithCounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter keeps the contents of underlying counter, including labels
type Epimetheus ¶
type Epimetheus struct { CommTimer *TimerWithCounter FunctionTimer *TimerWithCounter CacheRate *Counter BGWorker *Counter // contains filtered or unexported fields }
Epimetheus is the main struct of this library
You should have exactly one instance of it with `NewEpimetheusServer`, and then call `listen()` method of it
- config: Instance of viper
- CommTimer: An instance of `TimerWithCounter` which is used for your application communications
- FunctionTimer: An instance of `TimerWithCounter` which is used for your application important functions
- CacheRate: An instance of `Counter` which is used in conjunction with `Mnemosyne` project for caching
- BGWorker: An instance of `Counter` which is used for your application background workers
func NewEpimetheus ¶
func NewEpimetheus(config *viper.Viper) *Epimetheus
NewEpimetheus Creates a new instance of `Epimetheus` with prepared metrics in advance
func NewEpimetheusServer ¶
func NewEpimetheusServer(config *viper.Viper) *Epimetheus
NewEpimetheusServer Creates a new instance of `Epimetheus` without prepared metrics in advance
func (*Epimetheus) Listen ¶
func (e *Epimetheus) Listen() *Server
Listen makes epimetheus start on specified port if enabled, then return the server in order to stop later
func (*Epimetheus) NewCounter ¶
func (e *Epimetheus) NewCounter(name string, labelNames []string) *Counter
NewCounter creates an instance of `Counter` with specified configs
func (*Epimetheus) NewGauge ¶
func (e *Epimetheus) NewGauge(name string, labelNames []string) *Gauge
NewGauge creates an instance of `Gauge` with specified configs
func (*Epimetheus) NewTimer ¶
func (e *Epimetheus) NewTimer(name string, labelNames []string) *Timer
NewTimer creates an instance of `Timer` with specified configs
func (*Epimetheus) NewTimerWithCounter ¶
func (e *Epimetheus) NewTimerWithCounter(name string, labelNames []string) *TimerWithCounter
NewTimerWithCounter creates an instance of `TimerWithCounter` with specified configs
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge keeps the contents of underlying gauge, including labels
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains http server of Epimetheus instance
type StaticCounter ¶
type StaticCounter struct { Base *Counter // contains filtered or unexported fields }
StaticCounter keeps the contents of underlying counter, excluding labels
func (*StaticCounter) Inc ¶
func (sc *StaticCounter) Inc()
Inc increments the value of current Counter
type StaticGauge ¶
type StaticGauge struct { Base *Gauge // contains filtered or unexported fields }
StaticGauge keeps the contents of underlying gauge, excluding labels
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer keeps the contents of underlying timer, including labels
func (*Timer) RunWithError ¶
RunWithError gets a function with error and lables and run it with measurment
type TimerWithCounter ¶
TimerWithCounter consists of a Timer and a Counter in order to measure count and duration simultaneously
func (*TimerWithCounter) Done ¶
func (tc *TimerWithCounter) Done(start time.Time, labelValues ...string)
Done marks the related timer as done and increments the related counter too
func (*TimerWithCounter) Start ¶
func (tc *TimerWithCounter) Start() time.Time
Start creates an instance of `RunningTimerWithCounter` and returns it