instrumentation

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveExporter

type ActiveExporter struct {
	Metrics Metrics
	Client  *b.Client
	// contains filtered or unexported fields
}

ActiveExporter Push metrics to your favourite Warp10 instance You can manually tell this exporter to flush metrics or let a ticker do it for you

func NewActiveExporter

func NewActiveExporter(warp10Client b.Client, period *time.Duration) (*ActiveExporter, chan error)

NewActiveExporter Return an instanciated ActiveExporter Default behaviour is to send batch of metric at Period interval If period is nil, you have to manually Flush metrics. If the exporter failed to push metrics, it will keep them for the next batch and send you an error in the chan

func (*ActiveExporter) AddMetricToNextBatch

func (ae *ActiveExporter) AddMetricToNextBatch(m Metric)

AddMetricToNextBatch add a new metric to the next Flush call or Period

func (*ActiveExporter) Flush

func (ae *ActiveExporter) Flush() error

Flush send all metrics

type Counter

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

Counter is a metric that can only grow

func NewCounter

func NewCounter(name string, context b.Labels, help string) (mc *Counter)

NewCounter initialize a new counter

func (*Counter) Add

func (mc *Counter) Add(n uint64)

Add N to the counter

func (*Counter) Get

func (mc *Counter) Get() b.GTSList

Get return a plain GTS

func (*Counter) Help

func (mc *Counter) Help() string

Help return informations about this metric

func (*Counter) Inc

func (mc *Counter) Inc()

Inc add 1 to the counter

func (*Counter) Name

func (mc *Counter) Name() string

Name return the metric name of the counter

func (*Counter) Reset

func (mc *Counter) Reset()

Reset set to 0 the counter

type Gauge

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

Gauge is a metric that can only grow

func NewGauge

func NewGauge(name string, context b.Labels, help string) (mc *Gauge)

NewGauge initialize a new counter

func (*Gauge) Add

func (mc *Gauge) Add(n uint64)

Add N to the counter

func (*Gauge) Dec

func (mc *Gauge) Dec()

Dec N to the counter

func (*Gauge) Get

func (mc *Gauge) Get() b.GTSList

Get return a plain GTS

func (*Gauge) Help

func (mc *Gauge) Help() string

Help return informations about this metric

func (*Gauge) Inc

func (mc *Gauge) Inc()

Inc add 1 to the counter

func (*Gauge) Name

func (mc *Gauge) Name() string

Name return the metric name of the counter

func (*Gauge) Reset

func (mc *Gauge) Reset()

Reset set to 0 the counter

func (*Gauge) Set

func (mc *Gauge) Set(n uint64)

Set N to the counter

func (*Gauge) Sub

func (mc *Gauge) Sub(n uint64)

Sub N to the counter

type HandlerExporter

type HandlerExporter struct {
	Metrics Metrics
	Handler http.HandlerFunc
}

HandlerExporter allow you to add a route on your application

func NewHandlerExporter

func NewHandlerExporter() *HandlerExporter

NewHandlerExporter Return an instanciated HandlerExporter

func (*HandlerExporter) Register

func (he *HandlerExporter) Register(m Metric)

Register add a new metric to the bundle

type Metric

type Metric interface {
	Name() string
	Help() string
	Get() b.GTSList
	Reset()
}

Metric is a thing you can monitor

type Metrics

type Metrics []Metric

Metrics is a collection of Metric

func (Metrics) Get

func (m Metrics) Get() b.GTSList

func (Metrics) Len

func (m Metrics) Len() int

Allow to sort metrics by name

func (Metrics) Less

func (m Metrics) Less(i, j int) bool

func (Metrics) Swap

func (m Metrics) Swap(i, j int)

type PassiveExporter

type PassiveExporter struct {
	Metrics Metrics
	// contains filtered or unexported fields
}

PassiveExporter Expose your metrics on a web page in Sensision format Tools like Beamium cqn scrappe it

func NewPassiveExporter

func NewPassiveExporter(listen, path string) (*PassiveExporter, error)

NewPassiveExporter Return an instanciated PassiveExporter

func (*PassiveExporter) Register

func (pe *PassiveExporter) Register(m Metric)

Register add a new metric to the bundle

type State

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

func NewState

func NewState(name string, ctx b.Labels, help string) *State

func (*State) Get

func (s *State) Get() b.GTSList

Get return a plain GTS

func (*State) Help

func (s *State) Help() string

Help return informations about this metric

func (*State) Name

func (s *State) Name() string

Name return the metric name of the annotation

func (*State) Reset

func (s *State) Reset()

Reset set to "" the state

func (*State) Set

func (s *State) Set(newState string)

Set a new state value

Jump to

Keyboard shortcuts

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