Documentation ¶
Index ¶
Constants ¶
View Source
const ( CounterType = "counter" GaugeType = "gauge" SummaryType = "summary" HistogramType = "histogram" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector interface { // Registers provided metrics. // If metric can`t be registered an error will be returned. Register(metrics ...Metric) error // Collects all registered metrics and sends them into queue in RabbitMQ. // Register method should be called before this method. Collect(ctx context.Context) error // Stops collector and frees associated resources. Stop() error // Increments provided counter and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. CounterInc(name string, labels Labels) error // Adds provided value to the counter and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. CounterAdd(name string, labels Labels, value float64) error // Increments provided gauge and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. GaugeInc(name string, labels Labels) error // Decrements provided gauge and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. GaugeDec(name string, labels Labels) error // Adds provided value to the gauge and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. GaugeAdd(name string, labels Labels, value float64) error // Subtracts provided value to the gauge and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. GaugeSub(name string, labels Labels, value float64) error // Sets provided value to the gauge and attaches specified labels. // If metric not registered the ErrMetricNotRegistered will be returned. GaugeSet(name string, labels Labels, value float64) error // Observes provided summary with specified value and labels. // If metric not registered the ErrMetricNotRegistered will be returned. SummaryObserve(name string, labels Labels, value float64) error // Observes provided histogram with specified value and labels. // If metric not registered the ErrMetricNotRegistered will be returned. HistogramObserve(name string, labels Labels, value float64) error }
type Config ¶
type Config struct { Exchange string // RabbitMQ direct exchange Queue string // RabbitMQ queue Namespace string // default prefix for all metrics Subsystem string // subsystem between <namespace> and <name> in metric name RetryBackoffLimit int // max number of retries to reconnect to RabbitMQ before collector panics ExportEnabled bool // is export enabled? if false, metrics will not be sent to RabbitMQ ExportPeriod time.Duration // period, when collector collects all metrics into the batch StopTimeout time.Duration // timeout for graceful stop RetryPeriod time.Duration // period between retries ConstLabels Labels // default labels for all metrics }
type DTO ¶
type DTO struct { Name string `json:"n"` Value float64 `json:"v"` Labels map[string]string `json:"l"` }
func (DTO) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
type Deps ¶
type Deps struct {
Rabbit *rabbit.Connection // TCP connection for RabbitMQ
}
type Metric ¶
type Metric struct { Type string // metric type (counter/gauge/summary/histogram) Name string // metric name Help string // description LabelNames []string // possible labels // Summary properties Objectives map[float64]float64 // percentile groups MaxAge time.Duration // max age of observations AgeBuckets uint32 // number of buckets used to exclude observations that are older than MaxAge from the summary BufCap uint32 // default sample stream buffer size // Histogram properties Buckets []float64 // buckets into which observations are counted }
Click to show internal directories.
Click to hide internal directories.