reporters

package
v0.0.0-...-c4d7c29 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterReporterBuilder

func RegisterReporterBuilder(name string, builder ReporterFromConfigBuilder)

RegisterReporterBuilder can be used in init() methods on reporters to dynamically register

Types

type DataDog

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

func (*DataDog) ReportEvent

func (d *DataDog) ReportEvent(title string, message string, tags ...string)

func (*DataDog) ReportMetric

func (d *DataDog) ReportMetric(metricType MetricType, metric string, value float64, tags ...string)

type DogStatsd

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

func (DogStatsd) ReportEvent

func (d DogStatsd) ReportEvent(title string, message string, tags ...string)

func (*DogStatsd) ReportMetric

func (d *DogStatsd) ReportMetric(metricType MetricType, metric string, value float64, tags ...string)

type Log

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

Log is a simple log-based reporter to STDOUT.

func (*Log) ReportEvent

func (r *Log) ReportEvent(title string, message string, tags ...string)

ReportEvent will log a new event

func (*Log) ReportMetric

func (r *Log) ReportMetric(metricType MetricType, metric string, value float64, tags ...string)

ReportMetric will log a new metric

type MetricType

type MetricType string

MetricType indicates a valid metric type

const (
	CountMetricType        MetricType = "count"
	GaugeMetricType        MetricType = "gauge"
	HistogramMetricType    MetricType = "histogram"
	DistributionMetricType MetricType = "distribution"
	TimingMetricType       MetricType = "timing"
)

most common metric types

type Reporter

type Reporter interface {
	ReportMetric(metricType MetricType, metric string, value float64, tags ...string)
	ReportEvent(title string, message string, tags ...string)
}

Reporter is an interface on which to report events and metrics

func NewDataDogWithConfig

func NewDataDogWithConfig(cfg map[string]interface{}) (Reporter, error)

func NewDogStatsdWithConfig

func NewDogStatsdWithConfig(cfg map[string]interface{}) (Reporter, error)

func NewLogWithConfig

func NewLogWithConfig(cfg map[string]interface{}) (Reporter, error)

NewLogWithConfig will create a new log reporter with config

func ReporterFromTypeAndConfig

func ReporterFromTypeAndConfig(reporterType string, cfg map[string]interface{}) (Reporter, error)

ReporterFromTypeAndConfig will build a reporter from a config

type ReporterFromConfigBuilder

type ReporterFromConfigBuilder func(map[string]interface{}) (Reporter, error)

ReporterFromConfigBuilder defines the common builder interface

type Reporters

type Reporters map[string]Reporter

Reporters are many reporters convenience function

func (Reporters) ReportEvent

func (r Reporters) ReportEvent(title string, message string, tags ...string)

func (Reporters) ReportMetric

func (r Reporters) ReportMetric(metricType MetricType, metric string, value float64, tags ...string)

Jump to

Keyboard shortcuts

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