Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMeasurementAlreadyFinished = errors.New("measurement has already finished")
)
Functions ¶
func Record ¶
func Record(m *Measurement)
Types ¶
type Config ¶
type Config struct { }
Config defines a struct containing all the available configuration for this package.
type Driver ¶
type Driver interface {
Persist([]*Measurement) error
}
type InfluxDBConfig ¶
InfluxDBConfig specifies the configuration for connecting to a InfluxDB instance that is a little bit more friendly to instantiate from.
type InfluxDBDriver ¶
type InfluxDBDriver struct { Client *influx.Client Database string // contains filtered or unexported fields }
InfluxDBDriver implements the Driver interface that knows how to persist data points into InfluxDB.
func NewInfluxDBDriver ¶
func NewInfluxDBDriver(cfg *InfluxDBConfig) (*InfluxDBDriver, error)
NewInfluxDBDriver initializes an InfluxDBDriver instance with the provided configuration.
func (*InfluxDBDriver) CreateInfluxDB ¶
func (d *InfluxDBDriver) CreateInfluxDB() error
creates the InfluxDB database
func (*InfluxDBDriver) DropInfluxDB ¶
func (d *InfluxDBDriver) DropInfluxDB() error
drops the influx database
func (*InfluxDBDriver) Persist ¶
func (d *InfluxDBDriver) Persist(batch []*Measurement) error
Persist implements the Driver interface, persisting the data points to InfluxDB.
type Measurement ¶
type Measurement struct { Info ctxinfo.Info Name string StartedAt time.Time FinishedAt time.Time Data Data }
func NewMeasurement ¶
func NewMeasurement(ctx context.Context, name string, data Data) *Measurement
func (Measurement) Duration ¶
func (m Measurement) Duration() time.Duration
func (*Measurement) Finish ¶
func (m *Measurement) Finish() error
func (*Measurement) SetData ¶
func (m *Measurement) SetData(d map[string]interface{})
Click to show internal directories.
Click to hide internal directories.