cq

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ManageCQs

func ManageCQs(c *cli.Context, cqs []*ContinuousQuery, influxClient client.Client, sugar *zap.SugaredLogger) error

ManageCQs manages the given Continous Queries.

func NewCQFlags

func NewCQFlags() []cli.Flag

NewCQFlags creates new cli flags for CQs manager. Default these flags will be false

Types

type ContinuousQuery

type ContinuousQuery struct {
	Name                  string
	Database              string
	ResampleEveryInterval string
	ResampleForInterval   string
	// the Query string without the GROUP BY time part which will be added by
	// examining TimeInterval and OffsetIntervals.
	Query           string
	TimeInterval    string
	OffsetIntervals []string
	// contains filtered or unexported fields
}

ContinuousQuery represents an InfluxDB Continuous Query. By design ContinuousQuery doesn't try to be smart, it does not attempt to parse/validate any field, just act as a templating engine.

Example: CREATE CONTINUOUS QUERY <cq_name> ON <database_name> RESAMPLE EVERY <interval> FOR <interval> BEGIN <cq_query> END

func NewContinuousQuery

func NewContinuousQuery(
	name, database, resampleEveryInterval, resampleForInterval, query,
	timeInterval string, offsetIntervals []string) (*ContinuousQuery, error)

NewContinuousQuery creates new ContinuousQuery instance.

func (*ContinuousQuery) Deploy

func (cq *ContinuousQuery) Deploy(c client.Client, sugar *zap.SugaredLogger) error

Deploy ensures that all configured cqs are deployed in given InfluxDB server. This method is safe to run multiple times without changes as it will checks if the CQ exists and updated first. client and logger will be need to inject from higher level call

func (*ContinuousQuery) Drop

func (cq *ContinuousQuery) Drop(c client.Client, sugar *zap.SugaredLogger) error

Drop drop the cq from its database. Since influxDB doesn't raise error if cq doesn't exist, This won't check if the cq is already there.

func (*ContinuousQuery) Execute

func (cq *ContinuousQuery) Execute(c client.Client, sugar *zap.SugaredLogger) error

Execute runs all CQs query to aggregate historical data. This method is intended to use once in new deployment.

func (*ContinuousQuery) GetCurrentCQs

func (cq *ContinuousQuery) GetCurrentCQs(c client.Client, sugar *zap.SugaredLogger) (map[string]string, error)

GetCurrentCQs return a map[cqName]query of current CQs in the database

Jump to

Keyboard shortcuts

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