influx

package
v1.79.4-cluster Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkedResponse

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

ChunkedResponse is a wrapper over influx.ChunkedResponse. Used for better memory usage control while iterating over huge time series.

func (*ChunkedResponse) Close

func (cr *ChunkedResponse) Close() error

Close closes cr.

func (*ChunkedResponse) Next

func (cr *ChunkedResponse) Next() ([]int64, []float64, error)

Next reads the next part/chunk of time series. Returns io.EOF when time series was read entirely.

type Client

type Client struct {
	influx.Client
	// contains filtered or unexported fields
}

Client represents a wrapper over influx HTTP client

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient creates and returns influx client configured with passed Config

func (Client) Database

func (c Client) Database() string

Database returns database name

func (*Client) Explore

func (c *Client) Explore() ([]*Series, error)

Explore checks the existing data schema in influx by checking available fields and series, which unique combination represents all possible time series existing in database. The explore required to reduce the load on influx by querying field of the exact time series at once, instead of fetching all of the values over and over.

May contain non-existing time series.

func (*Client) FetchDataPoints

func (c *Client) FetchDataPoints(s *Series) (*ChunkedResponse, error)

FetchDataPoints performs SELECT request to fetch datapoints for particular field.

type Config

type Config struct {
	Addr      string
	Username  string
	Password  string
	Database  string
	Retention string
	ChunkSize int

	Filter Filter
}

Config contains fields required for Client configuration

type Filter

type Filter struct {
	Series    string
	TimeStart string
	TimeEnd   string
}

Filter contains configuration for filtering the timeseries

type LabelPair

type LabelPair struct {
	Name  string
	Value string
}

LabelPair is the key-value record of time series label

type Series

type Series struct {
	Measurement string
	Field       string
	LabelPairs  []LabelPair
}

Series holds the time series

Jump to

Keyboard shortcuts

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