base

package
v0.0.0-...-ff1b721 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilLogger = NewNilLogger()

NilLogger is a singleton silent logger.

Functions

This section is empty.

Types

type ConfigFunc

type ConfigFunc func(rc *ReportConfig)

func WithAttributes

func WithAttributes(attributes map[string]string) ConfigFunc

func WithBuckets

func WithBuckets(buckets []float64) ConfigFunc

func WithExposedAttributes

func WithExposedAttributes(names ...string) ConfigFunc

func WithHelp

func WithHelp(help string) ConfigFunc

func WithNamespace

func WithNamespace(namespace string) ConfigFunc

func WithQuantiles

func WithQuantiles(quantiles map[float64]float64) ConfigFunc

func WithSubsystem

func WithSubsystem(subsystem string) ConfigFunc

func WithUnit

func WithUnit(unit Unit) ConfigFunc

type Logger

type Logger interface {
	// Prints logs a message. Arguments should be handled in the manner of fmt.Printf.
	Printf(format string, args ...interface{})
}

Logger is an interface to the logger the reporter writes to.

func NewNilLogger

func NewNilLogger() Logger

NewNilLogger creates a silent logger.

func NewPrintLogger

func NewPrintLogger() Logger

NewPrintLogger creates a logger that prints to stdout.

type MockReporter

type MockReporter struct {
	AddCounterFunc func(string, float64, ...ConfigFunc)

	AddGaugeFunc func(string, float64, ...ConfigFunc)

	ObserveHistogramFunc func(string, float64, ...ConfigFunc)

	ObserveSummaryFunc func(string, float64, ...ConfigFunc)

	RegisterCounterFunc func(string, ...ConfigFunc)

	RegisterGaugeFunc func(string, ...ConfigFunc)

	RegisterHistogramFunc func(string, ...ConfigFunc)

	RegisterSummaryFunc func(string, ...ConfigFunc)

	SetGaugeFunc func(string, float64, ...ConfigFunc)

	ShutdownFunc func()
	// contains filtered or unexported fields
}

func NewMockReporter

func NewMockReporter() *MockReporter

func (*MockReporter) AddCounter

func (m *MockReporter) AddCounter(v0 string, v1 float64, v2 ...ConfigFunc)

func (*MockReporter) AddCounterFuncCallCount

func (m *MockReporter) AddCounterFuncCallCount() int

func (*MockReporter) AddCounterFuncCallParams

func (m *MockReporter) AddCounterFuncCallParams() []ReporterAddCounterParamSet

func (*MockReporter) AddGauge

func (m *MockReporter) AddGauge(v0 string, v1 float64, v2 ...ConfigFunc)

func (*MockReporter) AddGaugeFuncCallCount

func (m *MockReporter) AddGaugeFuncCallCount() int

func (*MockReporter) AddGaugeFuncCallParams

func (m *MockReporter) AddGaugeFuncCallParams() []ReporterAddGaugeParamSet

func (*MockReporter) ObserveHistogram

func (m *MockReporter) ObserveHistogram(v0 string, v1 float64, v2 ...ConfigFunc)

func (*MockReporter) ObserveHistogramFuncCallCount

func (m *MockReporter) ObserveHistogramFuncCallCount() int

func (*MockReporter) ObserveHistogramFuncCallParams

func (m *MockReporter) ObserveHistogramFuncCallParams() []ReporterObserveHistogramParamSet

func (*MockReporter) ObserveSummary

func (m *MockReporter) ObserveSummary(v0 string, v1 float64, v2 ...ConfigFunc)

func (*MockReporter) ObserveSummaryFuncCallCount

func (m *MockReporter) ObserveSummaryFuncCallCount() int

func (*MockReporter) ObserveSummaryFuncCallParams

func (m *MockReporter) ObserveSummaryFuncCallParams() []ReporterObserveSummaryParamSet

func (*MockReporter) RegisterCounter

func (m *MockReporter) RegisterCounter(v0 string, v1 ...ConfigFunc)

func (*MockReporter) RegisterCounterFuncCallCount

func (m *MockReporter) RegisterCounterFuncCallCount() int

func (*MockReporter) RegisterCounterFuncCallParams

func (m *MockReporter) RegisterCounterFuncCallParams() []ReporterRegisterCounterParamSet

func (*MockReporter) RegisterGauge

func (m *MockReporter) RegisterGauge(v0 string, v1 ...ConfigFunc)

func (*MockReporter) RegisterGaugeFuncCallCount

func (m *MockReporter) RegisterGaugeFuncCallCount() int

func (*MockReporter) RegisterGaugeFuncCallParams

func (m *MockReporter) RegisterGaugeFuncCallParams() []ReporterRegisterGaugeParamSet

func (*MockReporter) RegisterHistogram

func (m *MockReporter) RegisterHistogram(v0 string, v1 ...ConfigFunc)

func (*MockReporter) RegisterHistogramFuncCallCount

func (m *MockReporter) RegisterHistogramFuncCallCount() int

func (*MockReporter) RegisterHistogramFuncCallParams

func (m *MockReporter) RegisterHistogramFuncCallParams() []ReporterRegisterHistogramParamSet

func (*MockReporter) RegisterSummary

func (m *MockReporter) RegisterSummary(v0 string, v1 ...ConfigFunc)

func (*MockReporter) RegisterSummaryFuncCallCount

func (m *MockReporter) RegisterSummaryFuncCallCount() int

func (*MockReporter) RegisterSummaryFuncCallParams

func (m *MockReporter) RegisterSummaryFuncCallParams() []ReporterRegisterSummaryParamSet

func (*MockReporter) SetGauge

func (m *MockReporter) SetGauge(v0 string, v1 float64, v2 ...ConfigFunc)

func (*MockReporter) SetGaugeFuncCallCount

func (m *MockReporter) SetGaugeFuncCallCount() int

func (*MockReporter) SetGaugeFuncCallParams

func (m *MockReporter) SetGaugeFuncCallParams() []ReporterSetGaugeParamSet

func (*MockReporter) Shutdown

func (m *MockReporter) Shutdown()

func (*MockReporter) ShutdownFuncCallCount

func (m *MockReporter) ShutdownFuncCallCount() int

func (*MockReporter) ShutdownFuncCallParams

func (m *MockReporter) ShutdownFuncCallParams() []ReporterShutdownParamSet

type MockSimpleReporter

type MockSimpleReporter struct {
	ReportFunc func(string, float64, ...ConfigFunc)

	ShutdownFunc func()
	// contains filtered or unexported fields
}

func NewMockSimpleReporter

func NewMockSimpleReporter() *MockSimpleReporter

func (*MockSimpleReporter) Report

func (m *MockSimpleReporter) Report(v0 string, v1 float64, v2 ...ConfigFunc)

func (*MockSimpleReporter) ReportFuncCallCount

func (m *MockSimpleReporter) ReportFuncCallCount() int

func (*MockSimpleReporter) ReportFuncCallParams

func (m *MockSimpleReporter) ReportFuncCallParams() []SimpleReporterReportParamSet

func (*MockSimpleReporter) Shutdown

func (m *MockSimpleReporter) Shutdown()

func (*MockSimpleReporter) ShutdownFuncCallCount

func (m *MockSimpleReporter) ShutdownFuncCallCount() int

func (*MockSimpleReporter) ShutdownFuncCallParams

func (m *MockSimpleReporter) ShutdownFuncCallParams() []SimpleReporterShutdownParamSet

type ReportConfig

type ReportConfig struct {
	Namespace         string
	Subsystem         string
	Help              string
	Unit              Unit
	Attributes        map[string]string
	ExposedAttributes []string
	Buckets           []float64
	Quantiles         map[float64]float64
}

func ApplyConfigs

func ApplyConfigs(baseConfigs []ConfigFunc, configs []ConfigFunc) *ReportConfig

type Reporter

type Reporter interface {
	RegisterCounter(name string, configs ...ConfigFunc)
	RegisterGauge(name string, configs ...ConfigFunc)
	RegisterHistogram(name string, configs ...ConfigFunc)
	RegisterSummary(name string, configs ...ConfigFunc)
	AddCounter(name string, value float64, configs ...ConfigFunc)
	AddGauge(name string, value float64, configs ...ConfigFunc)
	SetGauge(name string, value float64, configs ...ConfigFunc)
	ObserveHistogram(name string, value float64, configs ...ConfigFunc)
	ObserveSummary(name string, value float64, configs ...ConfigFunc)
	Shutdown()
}

type ReporterAddCounterParamSet

type ReporterAddCounterParamSet struct {
	Arg0 string
	Arg1 float64
	Arg2 []ConfigFunc
}

type ReporterAddGaugeParamSet

type ReporterAddGaugeParamSet struct {
	Arg0 string
	Arg1 float64
	Arg2 []ConfigFunc
}

type ReporterObserveHistogramParamSet

type ReporterObserveHistogramParamSet struct {
	Arg0 string
	Arg1 float64
	Arg2 []ConfigFunc
}

type ReporterObserveSummaryParamSet

type ReporterObserveSummaryParamSet struct {
	Arg0 string
	Arg1 float64
	Arg2 []ConfigFunc
}

type ReporterRegisterCounterParamSet

type ReporterRegisterCounterParamSet struct {
	Arg0 string
	Arg1 []ConfigFunc
}

type ReporterRegisterGaugeParamSet

type ReporterRegisterGaugeParamSet struct {
	Arg0 string
	Arg1 []ConfigFunc
}

type ReporterRegisterHistogramParamSet

type ReporterRegisterHistogramParamSet struct {
	Arg0 string
	Arg1 []ConfigFunc
}

type ReporterRegisterSummaryParamSet

type ReporterRegisterSummaryParamSet struct {
	Arg0 string
	Arg1 []ConfigFunc
}

type ReporterSetGaugeParamSet

type ReporterSetGaugeParamSet struct {
	Arg0 string
	Arg1 float64
	Arg2 []ConfigFunc
}

type ReporterShutdownParamSet

type ReporterShutdownParamSet struct{}

type SimpleReporter

type SimpleReporter interface {
	Report(name string, value float64, configs ...ConfigFunc)
	Shutdown()
}

type SimpleReporterReportParamSet

type SimpleReporterReportParamSet struct {
	Arg0 string
	Arg1 float64
	Arg2 []ConfigFunc
}

type SimpleReporterShim

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

func NewSimpleReporterShim

func NewSimpleReporterShim(reporter SimpleReporter) *SimpleReporterShim

func (*SimpleReporterShim) AddCounter

func (r *SimpleReporterShim) AddCounter(name string, value float64, configs ...ConfigFunc)

func (*SimpleReporterShim) AddGauge

func (r *SimpleReporterShim) AddGauge(name string, value float64, configs ...ConfigFunc)

func (*SimpleReporterShim) ObserveHistogram

func (r *SimpleReporterShim) ObserveHistogram(name string, value float64, configs ...ConfigFunc)

func (*SimpleReporterShim) ObserveSummary

func (r *SimpleReporterShim) ObserveSummary(name string, value float64, configs ...ConfigFunc)

func (*SimpleReporterShim) RegisterCounter

func (r *SimpleReporterShim) RegisterCounter(name string, configs ...ConfigFunc)

func (*SimpleReporterShim) RegisterGauge

func (r *SimpleReporterShim) RegisterGauge(name string, configs ...ConfigFunc)

func (*SimpleReporterShim) RegisterHistogram

func (r *SimpleReporterShim) RegisterHistogram(name string, configs ...ConfigFunc)

func (*SimpleReporterShim) RegisterSummary

func (r *SimpleReporterShim) RegisterSummary(name string, configs ...ConfigFunc)

func (*SimpleReporterShim) SetGauge

func (r *SimpleReporterShim) SetGauge(name string, value float64, configs ...ConfigFunc)

func (*SimpleReporterShim) Shutdown

func (r *SimpleReporterShim) Shutdown()

type SimpleReporterShutdownParamSet

type SimpleReporterShutdownParamSet struct{}

type Unit

type Unit string
const (
	UnitCount        Unit = "Count"
	UnitPercent      Unit = "Percent"
	UnitSeconds      Unit = "Seconds"
	UnitMicroseconds Unit = "Microseconds"
	UnitMilliseconds Unit = "Milliseconds"
	UnitBytes        Unit = "Bytes"
	UnitKilobytes    Unit = "Kilobytes"
	UnitMegabytes    Unit = "Megabytes"
	UnitGigabytes    Unit = "Gigabytes"
	UnitTerabytes    Unit = "Terabytes"
	UnitBits         Unit = "Bits"
	UnitKilobits     Unit = "Kilobits"
	UnitMegabits     Unit = "Megabits"
	UnitGigabits     Unit = "Gigabits"
	UnitTerabits     Unit = "Terabits"
)

Jump to

Keyboard shortcuts

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