influxdb

package
v0.0.0-...-6202178 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeBatchConfig

func MakeBatchConfig(conf Config) client.BatchPointsConfig

func MakeClient

func MakeClient(conf Config) (client.Client, error)

func MakeFieldKinds

func MakeFieldKinds(conf Config) (map[string]FieldKind, error)

MakeFieldKinds reads the Config and returns a lookup map of tag names to the field type their values should be converted to.

func New

func New(params output.Params) (output.Output, error)

New returns new influxdb output

Types

type Config

type Config struct {
	// Connection.
	Addr             null.String        `json:"addr" envconfig:"K6_INFLUXDB_ADDR"`
	Username         null.String        `json:"username,omitempty" envconfig:"K6_INFLUXDB_USERNAME"`
	Password         null.String        `json:"password,omitempty" envconfig:"K6_INFLUXDB_PASSWORD"`
	Insecure         null.Bool          `json:"insecure,omitempty" envconfig:"K6_INFLUXDB_INSECURE"`
	PayloadSize      null.Int           `json:"payloadSize,omitempty" envconfig:"K6_INFLUXDB_PAYLOAD_SIZE"`
	PushInterval     types.NullDuration `json:"pushInterval,omitempty" envconfig:"K6_INFLUXDB_PUSH_INTERVAL"`
	ConcurrentWrites null.Int           `json:"concurrentWrites,omitempty" envconfig:"K6_INFLUXDB_CONCURRENT_WRITES"`

	// Samples.
	DB           null.String `json:"db" envconfig:"K6_INFLUXDB_DB"`
	Precision    null.String `json:"precision,omitempty" envconfig:"K6_INFLUXDB_PRECISION"`
	Retention    null.String `json:"retention,omitempty" envconfig:"K6_INFLUXDB_RETENTION"`
	Consistency  null.String `json:"consistency,omitempty" envconfig:"K6_INFLUXDB_CONSISTENCY"`
	TagsAsFields []string    `json:"tagsAsFields,omitempty" envconfig:"K6_INFLUXDB_TAGS_AS_FIELDS"`
}

func GetConsolidatedConfig

func GetConsolidatedConfig(jsonRawConf json.RawMessage, env map[string]string, url string) (Config, error)

GetConsolidatedConfig combines {default config values + JSON config + environment vars + URL config values}, and returns the final result.

func NewConfig

func NewConfig() Config

NewConfig creates a new InfluxDB output config with some default values.

func ParseJSON

func ParseJSON(data json.RawMessage) (Config, error)

ParseJSON parses the supplied JSON into a Config.

func ParseURL

func ParseURL(text string) (Config, error)

ParseURL parses the supplied URL into a Config.

func (Config) Apply

func (c Config) Apply(cfg Config) Config

type FieldKind

type FieldKind int

FieldKind defines Enum for tag-to-field type conversion

const (
	// String field (default)
	String FieldKind = iota
	// Int field
	Int
	// Float field
	Float
	// Bool field
	Bool
)

type Output

type Output struct {
	output.SampleBuffer

	Client    client.Client
	Config    Config
	BatchConf client.BatchPointsConfig
	// contains filtered or unexported fields
}

Output is the influxdb Output struct

func (*Output) Description

func (o *Output) Description() string

Description returns a human-readable description of the output.

func (*Output) Start

func (o *Output) Start() error

Start tries to open the specified JSON file and starts the goroutine for metric flushing. If gzip encoding is specified, it also handles that.

func (*Output) Stop

func (o *Output) Stop() error

Stop flushes any remaining metrics and stops the goroutine.

Jump to

Keyboard shortcuts

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