monitoring

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log() *zap.Logger

Log returns correct registered logger

func Logs

func Logs() *zap.SugaredLogger

Logs return sugared zap logger

func RegisterLogger

func RegisterLogger(l *zap.Logger)

RegisterLogger new logger as main logger for service RegisterLogger is NOT THREAD SAFE

func RegisterReporter

func RegisterReporter(r Reporter)

RegisterReporter change current used reporter with provider default reporter is NopReporter that do nothing

Types

type NopReporter

type NopReporter struct {
}

NopReporter is reporter that does nothing

func (NopReporter) Counter

func (n NopReporter) Counter(_ string, _ float64)

Counter does nothing

func (NopReporter) Gauge

func (n NopReporter) Gauge(_ string, _ float64)

Gauge does nothing

func (NopReporter) Histogram

func (n NopReporter) Histogram(_ string, _ float64)

Histogram does nothing

func (NopReporter) Inc

func (n NopReporter) Inc(_ string)

Inc does nothing

func (NopReporter) Timer added in v0.7.0

func (n NopReporter) Timer(_ string) Timer

Timer returns Timer object that measure time between its creation and calling Done Function

type PrometheusReporter

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

PrometheusReporter is a reporter that allow you to "send" metrics to prometheus to allow use all of prometheus metric has format: metric_name;label:value,label1:value2

func NewPrometheusReporter

func NewPrometheusReporter() *PrometheusReporter

NewPrometheusReporter create instance of reporter that allow you to report stats to prometheus

func (*PrometheusReporter) Counter

func (p *PrometheusReporter) Counter(metric string, val float64)

Counter increment value of metric by val metric schema: metric_name;label:value,label1:value2

func (*PrometheusReporter) Gauge

func (p *PrometheusReporter) Gauge(metric string, val float64)

Gauge increment value of metric by val metric schema: metric_name;label:value,label1:value2

func (*PrometheusReporter) Histogram

func (p *PrometheusReporter) Histogram(metric string, val float64)

Histogram observer value of metric histogram metric schema: metric_name;label:value,label1:value2

func (*PrometheusReporter) Inc

func (p *PrometheusReporter) Inc(metric string)

Inc increment value of metric metric schema: metric_name;label:value,label1:value2

func (*PrometheusReporter) RegisterCounter

func (p *PrometheusReporter) RegisterCounter(name string, c prometheus.Counter)

RegisterCounter register counter in prometheus default registry and add to map counter

func (*PrometheusReporter) RegisterCounterVec

func (p *PrometheusReporter) RegisterCounterVec(name string, c *prometheus.CounterVec)

RegisterCounterVec register counterVec in prometheus default registry and add to map counter

func (*PrometheusReporter) RegisterGauge

func (p *PrometheusReporter) RegisterGauge(name string, c prometheus.Gauge)

RegisterGauge register gauge in prometheus default registry and add to map counter

func (*PrometheusReporter) RegisterGaugeVec

func (p *PrometheusReporter) RegisterGaugeVec(name string, c *prometheus.GaugeVec)

RegisterGaugeVec register gaugeVec in prometheus default registry and add to map counter

func (*PrometheusReporter) RegisterHistogram

func (p *PrometheusReporter) RegisterHistogram(name string, c prometheus.Histogram)

RegisterHistogram register histogram in prometheus default registry and add to map counter

func (*PrometheusReporter) RegisterHistogramVec

func (p *PrometheusReporter) RegisterHistogramVec(name string, c *prometheus.HistogramVec)

RegisterHistogramVec register histogramVec in prometheus default registry and add to map counter

func (*PrometheusReporter) Timer added in v0.7.0

func (p *PrometheusReporter) Timer(metric string) Timer

Timer allows you to measure time. It returns Timer object on which you have to call Done to end measurement

type Reporter

type Reporter interface {
	Counter(label string, val float64)
	Inc(label string)
	Histogram(label string, val float64)
	Gauge(label string, val float64)
	Timer(label string) Timer
}

Reporter is a interface for gather information and send external monitoring tool

func Report

func Report() Reporter

Report is a function that returns reporter instance It allows you to report stats to external monitoring

type Timer added in v0.7.0

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

Timer is used for time measurement

func (Timer) Done added in v0.7.0

func (t Timer) Done()

Done end time measurement

Jump to

Keyboard shortcuts

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