influxq

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContinuousQueryTemplate = "CREATE CONTINUOUS QUERY \"%s\" ON \"%s\" " +
	"BEGIN SELECT %s " +
	"INTO %s FROM \"%s\" " +
	"GROUP BY time(%s),* END"

Parameters: continuous query name, destinationDbName, appended list of op("field"), newmeasurementname, originmeasurement, time interval

View Source
var CreateRetentionPolicyTemplate = "%s RETENTION POLICY %q ON %q duration %s replication 1 shard duration %s"
View Source
var DeviceInfoAggregationFunctions = map[string]string{
	"numsessions": "sum(\"numsessions\")",
}

Aggregation functions for EdgeEvents device info stats continuous queries

View Source
var DropContinuousQueryTemplate = "DROP CONTINUOUS QUERY \"%s\" ON \"%s\""

Parameters: continuous query name and DbName

View Source
var DropRetentionPolicyTemplate = "DROP RETENTION POLICY %q ON %q"

Parameters: retention policy name and DbName

View Source
var InfluxQPrecision = "us"
View Source
var InfluxQPushCountMax = 5000
View Source
var InfluxQPushCountTrigger = 50
View Source
var InfluxQPushInterval time.Duration = time.Second
View Source
var InfluxQReconnectDelay time.Duration = 10 * time.Second
View Source
var LatencyAggregationFunctions = map[string]string{
	"0s":         "sum(\"0s\")",
	"5ms":        "sum(\"5ms\")",
	"10ms":       "sum(\"10ms\")",
	"25ms":       "sum(\"25ms\")",
	"50ms":       "sum(\"50ms\")",
	"100ms":      "sum(\"100ms\")",
	"min":        "min(\"min\")",
	"max":        "max(\"max\")",
	"total":      "sum(\"total\")",
	"avg":        "sum(\"total\") / sum(\"numsamples\")",
	"numsamples": "sum(\"numsamples\")",
}

Aggregation functions for EdgeEvents latency stats continuous queries

Functions

func AutoProvCountToPt

func AutoProvCountToPt(apCount *edgeproto.AutoProvCount, dmeid string, ts time.Time) (*client.Point, error)

func CreateContinuousQuery

func CreateContinuousQuery(origin *InfluxQ, dest *InfluxQ, cq *ContinuousQuerySettings) error

func CreateInfluxContinuousQueryName

func CreateInfluxContinuousQueryName(measurement string, interval time.Duration) string

func CreateInfluxFullyQualifiedMeasurementName

func CreateInfluxFullyQualifiedMeasurementName(dbName string, measurement string, interval time.Duration, retention time.Duration) string

func DropContinuousQuery

func DropContinuousQuery(origin *InfluxQ, dest *InfluxQ, measurement string, interval time.Duration, retention time.Duration) error

Drop ContinuousQuery

func GetRetentionPolicyName

func GetRetentionPolicyName(dbName string, retention time.Duration, rpType RetentionPolicyType) string

func ParseAutoProvCount

func ParseAutoProvCount(cols []string, values []interface{}) (*edgeproto.AutoProvCount, string, time.Time, error)

Types

type ContinuousQuerySettings

type ContinuousQuerySettings struct {
	Measurement          string
	AggregationFunctions map[string]string // maps new field name to an aggregation function
	CollectionInterval   time.Duration
	RetentionPolicyTime  time.Duration
}

Struct with information used to create Continuous Query

func CreateDeviceInfoContinuousQuerySettings

func CreateDeviceInfoContinuousQuerySettings(collectionInterval time.Duration, retention time.Duration) *ContinuousQuerySettings

func CreateLatencyContinuousQuerySettings

func CreateLatencyContinuousQuerySettings(collectionInterval time.Duration, retention time.Duration) *ContinuousQuerySettings

type InfluxQ

type InfluxQ struct {
	ErrBatch  uint64
	ErrPoint  uint64
	Qfull     uint64
	QWrites   uint64
	DatWrites uint64
	// contains filtered or unexported fields
}

func NewInfluxQ

func NewInfluxQ(DBName, username, password string) *InfluxQ

func (*InfluxQ) AddMetric

func (q *InfluxQ) AddMetric(metrics ...*edgeproto.Metric)

func (*InfluxQ) CreateRetentionPolicy

func (q *InfluxQ) CreateRetentionPolicy(retentionTime time.Duration, rpType RetentionPolicyType) error

Create a retention policy for db

func (*InfluxQ) DoPush

func (q *InfluxQ) DoPush()

func (*InfluxQ) DropRetentionPolicy

func (q *InfluxQ) DropRetentionPolicy(rpName string) error

Note: "Dropping a retention policy will permanently delete all measurements and data stored in the retention policy." - influxdb docs

func (*InfluxQ) InitRetentionPolicy

func (q *InfluxQ) InitRetentionPolicy(dur time.Duration)

must be called before Start()

func (*InfluxQ) PushAutoProvCounts

func (q *InfluxQ) PushAutoProvCounts(ctx context.Context, msg *edgeproto.AutoProvCounts) error

func (*InfluxQ) QueryDB

func (q *InfluxQ) QueryDB(cmd string) ([]client.Result, error)

func (*InfluxQ) RecvMetric

func (q *InfluxQ) RecvMetric(ctx context.Context, metric *edgeproto.Metric)

func (*InfluxQ) RunPush

func (q *InfluxQ) RunPush()

func (*InfluxQ) Start

func (q *InfluxQ) Start(addr string) error

func (*InfluxQ) Stop

func (q *InfluxQ) Stop()

func (*InfluxQ) WaitConnected

func (q *InfluxQ) WaitConnected() bool

func (*InfluxQ) WaitCreated

func (q *InfluxQ) WaitCreated() error

type RetentionPolicyType

type RetentionPolicyType int
const (
	UnknownRetentionPolicy RetentionPolicyType = iota
	DefaultRetentionPolicy
	NonDefaultRetentionPolicy
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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