Documentation ¶
Index ¶
- func GetLocalHost() string
- func MockEvents() []optic.Event
- func MockLogLines() []optic.LogLine
- func MockMetrics() []optic.Metric
- func MockRaw() []optic.Raw
- func TestLogLine(content string) optic.LogLine
- func TestMetric(value interface{}, name ...string) optic.Metric
- func TestRaw(value []byte) optic.Raw
- type Accumulator
- func (a *Accumulator) AddError(err error)
- func (a *Accumulator) AddEvent(event optic.Event)
- func (a *Accumulator) AddEvents(events []optic.Event)
- func (a *Accumulator) AddLogLine(path string, content string, tags map[string]string, ...)
- func (a *Accumulator) AddLogLines(loglines []optic.LogLine)
- func (a *Accumulator) AddMetric(name string, tags map[string]string, fields map[string]interface{}, ...)
- func (a *Accumulator) AddMetricType(name string, tags map[string]string, fields map[string]interface{}, ...)
- func (a *Accumulator) AddMetrics(metrics []optic.Metric)
- func (a *Accumulator) AddRaw(source string, value []byte, tags map[string]string, ...)
- func (a *Accumulator) AddRaws(raws []optic.Raw)
- func (a *Accumulator) AssertContainsMetricWithTaggedFields(t *testing.T, name string, tags map[string]string, ...)
- func (a *Accumulator) ClearEvents()
- func (a *Accumulator) Count() uint64
- func (a *Accumulator) Debug() bool
- func (a *Accumulator) FieldsCount() int
- func (a *Accumulator) GatherError(gf func(optic.Accumulator) error) error
- func (a *Accumulator) GetMetric(name string) (*Event, bool)
- func (a *Accumulator) HasMetric(name string) bool
- func (a *Accumulator) SetDebug(debug bool)
- func (a *Accumulator) Wait(n int)
- func (a *Accumulator) WaitError(n int)
- type Event
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalHost ¶
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 MockEvents ¶
MockEvents returns a mock `[]optic.Event“ object for using in unit tests.
func MockLogLines ¶
MockLogLines returns a mock `[]optic.LogLine“ object for using in unit tests.
func MockMetrics ¶
MockMetrics returns a mock `[]optic.Metric“ object for using in unit tests.
func TestLogLine ¶
TestLogLine Returns a simple test logline event:
path -> "test1" content -> content tags -> "tag1":"value1" fields -> nil
func TestMetric ¶
TestMetric Returns a simple test metric event:
namespace -> "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 *sync.Cond Events []*Event Discard bool Errors []error // contains filtered or unexported fields }
Accumulator defines a mocked out accumulator
func (*Accumulator) AddError ¶
func (a *Accumulator) AddError(err error)
AddError appends the given error to Accumulator.Errors.
func (*Accumulator) AddEvent ¶
func (a *Accumulator) AddEvent(event optic.Event)
func (*Accumulator) AddEvents ¶
func (a *Accumulator) AddEvents(events []optic.Event)
func (*Accumulator) AddLogLine ¶
func (*Accumulator) AddLogLines ¶
func (a *Accumulator) AddLogLines(loglines []optic.LogLine)
func (*Accumulator) AddMetricType ¶
func (a *Accumulator) AddMetricType( name string, tags map[string]string, fields map[string]interface{}, metricType optic.MetricType, timestamp ...time.Time, )
func (*Accumulator) AddMetrics ¶
func (a *Accumulator) AddMetrics(metrics []optic.Metric)
func (*Accumulator) AddRaws ¶
func (a *Accumulator) AddRaws(raws []optic.Raw)
func (*Accumulator) AssertContainsMetricWithTaggedFields ¶
func (*Accumulator) ClearEvents ¶
func (a *Accumulator) ClearEvents()
func (*Accumulator) Count ¶
func (a *Accumulator) Count() uint64
func (*Accumulator) Debug ¶
func (a *Accumulator) Debug() bool
func (*Accumulator) FieldsCount ¶
func (a *Accumulator) FieldsCount() int
FieldsCount returns the total number of fields in the accumulator, across all events.
func (*Accumulator) GatherError ¶
func (a *Accumulator) GatherError(gf func(optic.Accumulator) error) error
GatherError calls the given Gather function and returns the first error found.
func (*Accumulator) GetMetric ¶
func (a *Accumulator) GetMetric(name string) (*Event, bool)
GetMetric gets the specified metric point from the accumulator.
func (*Accumulator) HasMetric ¶
func (a *Accumulator) HasMetric(name string) bool
HasMetric returns true if the accumulator has a metric with the given name.
func (*Accumulator) SetDebug ¶
func (a *Accumulator) SetDebug(debug bool)
func (*Accumulator) Wait ¶
func (a *Accumulator) Wait(n int)
Wait waits for the given number of events to be added to the accumulator.
func (*Accumulator) WaitError ¶
func (a *Accumulator) WaitError(n int)
WaitError waits for the given number of errors to be added to the accumulator.