influx

package
v0.0.0-...-598a1f7 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: AGPL-3.0, MIT Imports: 5 Imported by: 0

Documentation

Overview

Package influx sends values to an influxdb database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (log.ValuesLogger, error)

New returns a new influx db logger

Types

type Config

type Config struct {
	Host         string        // The influxdb hostname
	Database     string        // The influxdb database name
	User         string        // The influxdb user name
	Password     string        // The influxdb user password
	WriteTimeout time.Duration // Timeout for influxdb writes
}

Config represents the config for an influx.Logger instance

type Logger

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

Logger logs values to a specified influxdb database

func (*Logger) CreateBatch

func (l *Logger) CreateBatch() (client.BatchPoints, error)

CreateBatch creates a batch attached to the db to add points to

func (*Logger) CreatePoint

func (l *Logger) CreatePoint(values map[string]interface{}) (*client.Point, error)

CreatePoint creates a batch point for influx from a set of values If you need more control you can create points and use WriteBatch

func (*Logger) SetErrorLogger

func (l *Logger) SetErrorLogger(errLogger log.PrintLogger)

SetErrorLogger sets the error logger for this influx.Logger

func (*Logger) Values

func (l *Logger) Values(values map[string]interface{})

Values sends a single set of values to influxdb as a batch

func (*Logger) ValuesBatch

func (l *Logger) ValuesBatch(valuesArray []map[string]interface{})

ValuesBatch sends multiple set of values to influxdb as a batch

func (*Logger) WriteBatch

func (l *Logger) WriteBatch(points client.BatchPoints)

WriteBatch writes the points to the influxdb connection within a goroutine to avoid blockng the caller

type StdErrLogger

type StdErrLogger struct{}

StdErrLogger prints to stdout using fmt.Printf and is used as the default error logger for stats errors

func (StdErrLogger) Printf

func (l StdErrLogger) Printf(f string, args ...interface{})

Printf prints to stdout using fmt.Printf

Jump to

Keyboard shortcuts

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