dataexporter

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter interface {
	// Export will send the data to the exporter.
	Export(context.Context, *log.Logger, []exporter.FeatureEvent) error

	// IsBulk return false if we should directly send the data as soon as it is produce
	// and true if we collect the data to send them in bulk.
	IsBulk() bool
}

Exporter is an interface to describe how a exporter looks like.

type Scheduler

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

Scheduler is the struct that handle the data collection.

func NewScheduler

func NewScheduler(ctx context.Context, flushInterval time.Duration, maxEventInMemory int64,
	exp Exporter, logger *log.Logger,
) *Scheduler

NewScheduler allows to create a new instance of Scheduler ready to be used to export data.

func (*Scheduler) AddEvent

func (dc *Scheduler) AddEvent(event exporter.FeatureEvent)

AddEvent allow to add an event to the local cache and to call the exporter if we reach the maximum number of events that can be present in the cache.

func (*Scheduler) Close

func (dc *Scheduler) Close()

Close will stop the daemon and send the data still in the cache

func (*Scheduler) StartDaemon

func (dc *Scheduler) StartDaemon()

StartDaemon will start a goroutine to check every X seconds if we should send the data. The daemon is started only if we have a bulk exporter.

Jump to

Keyboard shortcuts

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