Documentation ¶
Index ¶
- func GetLocalHost() string
- func MockMetrics() []telegraf.Metric
- func TestMetric(value interface{}, name ...string) telegraf.Metric
- type Accumulator
- func (a *Accumulator) AddCounter(measurement string, fields map[string]interface{}, tags map[string]string, ...)
- func (a *Accumulator) AddError(err error)
- func (a *Accumulator) AddFields(measurement string, fields map[string]interface{}, tags map[string]string, ...)
- func (a *Accumulator) AddGauge(measurement string, fields map[string]interface{}, tags map[string]string, ...)
- func (a *Accumulator) AddMetrics(metrics []telegraf.Metric)
- func (a *Accumulator) AssertContainsFields(t *testing.T, measurement string, fields map[string]interface{})
- func (a *Accumulator) AssertContainsTaggedFields(t *testing.T, measurement string, fields map[string]interface{}, ...)
- func (a *Accumulator) AssertDoesNotContainMeasurement(t *testing.T, measurement string)
- func (a *Accumulator) ClearMetrics()
- func (a *Accumulator) Debug() bool
- func (a *Accumulator) DisablePrecision()
- func (a *Accumulator) Get(measurement string) (*Metric, bool)
- func (a *Accumulator) HasFloatField(measurement string, field string) bool
- func (a *Accumulator) HasIntField(measurement string, field string) bool
- func (a *Accumulator) HasMeasurement(measurement string) bool
- func (a *Accumulator) HasUIntField(measurement string, field string) bool
- func (a *Accumulator) NFields() int
- func (a *Accumulator) NMetrics() uint64
- func (a *Accumulator) SetDebug(debug bool)
- func (a *Accumulator) SetPrecision(precision, interval time.Duration)
- type Metric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalHost ¶ added in v0.1.4
func GetLocalHost() string
GetLocalHost returns the DOCKER_HOST environment variable, parsing out any scheme or ports so that only the IP address is returned.
func MockMetrics ¶ added in v1.2.0
MockMetrics returns a mock []telegraf.Metric object for using in unit tests of telegraf output sinks.
func TestMetric ¶ added in v1.2.0
TestMetric Returns a simple test point:
measurement -> "test1" or name tags -> "tag1":"value1" value -> value time -> time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
Types ¶
type Accumulator ¶
type Accumulator struct { sync.Mutex Metrics []*Metric Discard bool Errors []error // contains filtered or unexported fields }
Accumulator defines a mocked out accumulator
func (*Accumulator) AddCounter ¶ added in v1.2.0
func (*Accumulator) AddError ¶ added in v1.2.0
func (a *Accumulator) AddError(err error)
AddError appends the given error to Accumulator.Errors.
func (*Accumulator) AddFields ¶ added in v0.2.0
func (a *Accumulator) AddFields( measurement string, fields map[string]interface{}, tags map[string]string, timestamp ...time.Time, )
AddFields adds a measurement point with a specified timestamp.
func (*Accumulator) AddMetrics ¶ added in v1.2.0
func (a *Accumulator) AddMetrics(metrics []telegraf.Metric)
func (*Accumulator) AssertContainsFields ¶ added in v0.10.0
func (a *Accumulator) AssertContainsFields( t *testing.T, measurement string, fields map[string]interface{}, )
func (*Accumulator) AssertContainsTaggedFields ¶ added in v0.10.0
func (*Accumulator) AssertDoesNotContainMeasurement ¶ added in v1.2.0
func (a *Accumulator) AssertDoesNotContainMeasurement(t *testing.T, measurement string)
func (*Accumulator) ClearMetrics ¶ added in v1.2.0
func (a *Accumulator) ClearMetrics()
func (*Accumulator) Debug ¶ added in v0.2.0
func (a *Accumulator) Debug() bool
func (*Accumulator) DisablePrecision ¶ added in v1.2.0
func (a *Accumulator) DisablePrecision()
func (*Accumulator) Get ¶
func (a *Accumulator) Get(measurement string) (*Metric, bool)
Get gets the specified measurement point from the accumulator
func (*Accumulator) HasFloatField ¶ added in v0.10.0
func (a *Accumulator) HasFloatField(measurement string, field string) bool
HasFloatValue returns true if the given measurement has a float value
func (*Accumulator) HasIntField ¶ added in v0.10.0
func (a *Accumulator) HasIntField(measurement string, field string) bool
HasIntValue returns true if the measurement has an Int value
func (*Accumulator) HasMeasurement ¶ added in v0.1.8
func (a *Accumulator) HasMeasurement(measurement string) bool
HasMeasurement returns true if the accumulator has a measurement with the given name
func (*Accumulator) HasUIntField ¶ added in v0.10.0
func (a *Accumulator) HasUIntField(measurement string, field string) bool
HasUIntValue returns true if the measurement has a UInt value
func (*Accumulator) NFields ¶ added in v0.10.0
func (a *Accumulator) NFields() int
NFields returns the total number of fields in the accumulator, across all measurements
func (*Accumulator) NMetrics ¶ added in v1.2.0
func (a *Accumulator) NMetrics() uint64
func (*Accumulator) SetDebug ¶ added in v0.2.0
func (a *Accumulator) SetDebug(debug bool)
func (*Accumulator) SetPrecision ¶ added in v1.2.0
func (a *Accumulator) SetPrecision(precision, interval time.Duration)