influxdb

package
v0.195.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Org    NameOrID
	Bucket NameOrID
	Host   string
	Token  string
}

Config contains the common configuration for interacting with an influxdb instance.

type Dependency

type Dependency struct {
	Provider Provider
}

Dependency will inject the Provider into the dependency chain.

func (Dependency) Inject

func (d Dependency) Inject(ctx context.Context) context.Context

Inject will inject the Provider into the dependency chain.

type ErrorProvider

type ErrorProvider struct{}

ErrorProvider provides default implementations for a Provider. This implements all of the Provider methods by returning an error with the code codes.Unimplemented.

func (ErrorProvider) ReaderFor

func (u ErrorProvider) ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (ErrorProvider) SeriesCardinalityReaderFor

func (u ErrorProvider) SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (ErrorProvider) WriterFor

func (u ErrorProvider) WriterFor(ctx context.Context, conf Config) (Writer, error)

type Field

type Field = protocol.Field

Field holds the keys and values for a bunch of Metric Field k/v pairs where Value can be a uint64, int64, int, float32, float64, string, or bool.

type HttpClient

type HttpClient struct {
	Client http.Client
	Config Config
}

HttpClient is an http client for reading from an influxdb instance.

func (*HttpClient) Query

func (h *HttpClient) Query(ctx context.Context, f func(table flux.Table) error, file *ast.File, now time.Time, mem memory.Allocator) error

Query will create a new http.Request, send it to the server, then decode the request as a flux.TableIterator and invoke the function with each flux.Table.

type HttpProvider

type HttpProvider struct {
	DefaultConfig Config
}

HttpProvider is an implementation of the Provider that implements the read methods with HTTP calls to an influxdb query endpoint.

func (HttpProvider) ReaderFor

func (h HttpProvider) ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (HttpProvider) SeriesCardinalityReaderFor

func (h HttpProvider) SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (HttpProvider) WriterFor

func (h HttpProvider) WriterFor(ctx context.Context, conf Config) (Writer, error)

type Metric

type Metric = protocol.Metric

Metric is the interface for marshaling, if you implement this interface you can be marshalled into the line protocol. Woot!

type NameOrID

type NameOrID struct {
	ID   string
	Name string
}

NameOrID signifies the name of an organization/bucket or an ID for an organization/bucket.

func (NameOrID) IdOrName

func (n NameOrID) IdOrName() string

IdOrName returns the ID if set, otherwise it returns the Name

func (NameOrID) IsValid

func (n NameOrID) IsValid() bool

IsValid will return true if both the name and the id are not set at the same time.

func (NameOrID) IsZero

func (n NameOrID) IsZero() bool

IsZero will return true if neither the id nor name are set.

type Predicate

type Predicate struct {
	interpreter.ResolvedFunction

	// KeepEmpty determines if empty tables should be retained
	// if none of the rows pass the filter.
	KeepEmpty bool
}

Predicate defines a predicate to filter storage with.

func (*Predicate) Copy

func (p *Predicate) Copy() Predicate

Copy produces a deep copy of the Predicate.

type PredicateSet

type PredicateSet []Predicate

PredicateSet holds a set of predicates that will filter the results.

func (PredicateSet) Copy

func (ps PredicateSet) Copy() PredicateSet

Copy produces a deep copy of the PredicateSet.

type Provider

type Provider interface {
	// ReaderFor will construct a Reader using the given configuration parameters.
	// If the parameters are their zero values, appropriate defaults may be used
	// or an error may be returned if the implementation does not have a default.
	ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

	// SeriesCardinalityReaderFor will return a Reader
	// for the SeriesCardinality operation.
	SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

	// WriterFor will construct a Writer using the given configuration parameters.
	// If the parameters are their zero values, appropriate defaults may be used
	// or an error may be returned if the implementation does not have a default.
	WriterFor(ctx context.Context, conf Config) (Writer, error)
}

Provider is an interface for creating a Reader that will read data from an influxdb instance.

This provides different provider methods depending on the read method. The read methods can be expanded so implementors of this interface should embed the UnimplementedProvider to automatically implement new methods with a default unimplemented stub.

func GetProvider

func GetProvider(ctx context.Context) Provider

GetProvider will return the Provider for the current context. If no Provider has been injected into the dependencies, this will return a default provider.

type Reader

type Reader interface {
	// Read will produce flux.Table values using the memory.Allocator
	// and it will pass those tables to the given function.
	Read(ctx context.Context, f func(flux.Table) error, mem memory.Allocator) error
}

Reader reads tables from an influxdb instance.

type Tag

type Tag = protocol.Tag

Tag holds the keys and values for a bunch of Tag k/v pairs.

type UnimplementedProvider

type UnimplementedProvider struct{}

UnimplementedProvider provides default implementations for a Provider. This implements all of the Provider methods by returning an error with the code codes.Unimplemented.

func (UnimplementedProvider) ReaderFor

func (u UnimplementedProvider) ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (UnimplementedProvider) SeriesCardinalityReaderFor

func (u UnimplementedProvider) SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (UnimplementedProvider) WriterFor

func (u UnimplementedProvider) WriterFor(ctx context.Context, conf Config) (Writer, error)

type Writer

type Writer interface {
	io.Closer
	Write(...Metric) error
}

Writer is a write on which points can be written in batches.

Jump to

Keyboard shortcuts

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