Documentation
¶
Overview ¶
Package bus defines interfaces for writing to and reading from the vulcan metric bus and the datastructures that get passed. Different packages (e.g. kafka) should actually implement the bus interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AckPayload ¶
type AckPayload struct {
SampleGroup SampleGroup
Done func(error)
}
AckPayload allows a SampleGroup to be passed around with a Done function so that a consumer can signal when the payload has been consumed.
type AckSource ¶
type AckSource interface {
Chan() <-chan AckPayload
Err() error
Stop()
}
AckSource proivdes a channel of AckPayload as a way to process SampleGroups. Stop can be called on the source to cause the channel to close. For each item in the payload, you MUST call Done. Done signifies that the contents of the payload have been processed, and takes an error parameter that may be nil. A non-nil value signifies that there is a non- recoverable error processing the payload. Calling Error on a payload item will cause the whole source to stop.
The contents should be read until the channel is closed. The caller should call Err() after the channel is closed. Err() will return nil if the source closed without error, otherwise it will return the first error encountered.
type Metric ¶
Metric must have a name and has 0..many labels. Modeled after prometheus metrics. TODO each prometheus metric also has a type (counter, gauge...) we should probably make this a field in the Metric struct. Right now the type is recorded as a label named "__type__".
type Timestamp ¶
type Timestamp int64
Timestamp is the milliseconds since the unix epoch. We use this instead of go's time.Time since prometheus expects time to be represented in this way, and this value is also more natural for our data model.
converting to a go time.Time value is simple: `time.Unix(t/1000, (ts%1000)*1000*1000))` but does cost extra instructions when we do this for EVERY datapoint only to turn around and turn it back into a int64 for prometheus query engine. Plus, dividing is an expensive instruction.