Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer interface {
Consume(s *Sample, custom interface{})
Close()
}
Consumer receives a resulting Sample
type Producer ¶
Producer is responsible for producing a single sample the function should return an error if it fails, custom can be used to send domain specific data to the collector.
type ProducerConsumer ¶
type ProducerFunc ¶
type Runner ¶
Runner will run the sampler asynchronously, it returns a context immediately that the caller can wait on. the done context is cancelled when:
- all the goroutines have completed
- all samples have been collected
func NewWithProducerConsumer ¶
func NewWithProducerConsumer(interval time.Duration, pc ProducerConsumer) Runner
type Sample ¶
type Sample struct {
// ID represents the number that uniquely identifies a given sample
// from the following ordered sequence
// 1, 2, 3 ... n
ID uint64
StartedAt time.Time
FinishedAt time.Time
// Err is set if the sample had an error (it failed), otherwise nil
Err error
}
Sample holds information related to a sample
type SortedByID ¶
type SortedByID []*Sample
func (SortedByID) Len ¶
func (s SortedByID) Len() int
func (SortedByID) Less ¶
func (s SortedByID) Less(i, j int) bool
func (SortedByID) Swap ¶
func (s SortedByID) Swap(i, j int)
type SortedByStartedAt ¶
type SortedByStartedAt []*Sample
func (SortedByStartedAt) Len ¶
func (s SortedByStartedAt) Len() int
func (SortedByStartedAt) Less ¶
func (s SortedByStartedAt) Less(i, j int) bool
func (SortedByStartedAt) Swap ¶
func (s SortedByStartedAt) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.