Documentation ¶
Index ¶
- func Log() *zap.Logger
- func Logs() *zap.SugaredLogger
- func RegisterLogger(l *zap.Logger)
- func RegisterReporter(r Reporter)
- type NopReporter
- type PrometheusReporter
- func (p *PrometheusReporter) Counter(metric string, val float64)
- func (p *PrometheusReporter) Gauge(metric string, val float64)
- func (p *PrometheusReporter) Histogram(metric string, val float64)
- func (p *PrometheusReporter) Inc(metric string)
- func (p *PrometheusReporter) RegisterCounter(name string, c prometheus.Counter)
- func (p *PrometheusReporter) RegisterCounterVec(name string, c *prometheus.CounterVec)
- func (p *PrometheusReporter) RegisterGauge(name string, c prometheus.Gauge)
- func (p *PrometheusReporter) RegisterGaugeVec(name string, c *prometheus.GaugeVec)
- func (p *PrometheusReporter) RegisterHistogram(name string, c prometheus.Histogram)
- func (p *PrometheusReporter) RegisterHistogramVec(name string, c *prometheus.HistogramVec)
- func (p *PrometheusReporter) Timer(metric string) Timer
- type Reporter
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterLogger ¶
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) Histogram ¶
func (n NopReporter) Histogram(_ string, _ float64)
Histogram 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