siridb

package
v0.0.0-...-a212069 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseGenerator

type BaseGenerator struct {
}

BaseGenerator contains settings specific for SiriDB

func (*BaseGenerator) GenerateEmptyQuery

func (g *BaseGenerator) GenerateEmptyQuery() query.Query

GenerateEmptyQuery returns an empty query.SiriDB.

func (*BaseGenerator) NewDevops

func (g *BaseGenerator) NewDevops(start, end time.Time, scale int) (utils.QueryGenerator, error)

NewDevops creates a new devops use case query generator.

type Devops

type Devops struct {
	*BaseGenerator
	*devops.Core
}

Devops produces SiriDB-specific queries for all the devops query types.

func (*Devops) GroupByOrderByLimit

func (d *Devops) GroupByOrderByLimit(qi query.Query)

GroupByOrderByLimit populates a query.Query that has a time WHERE clause, that groups by a truncated date, orders by that date, and takes a limit:

select max(1m) from `usage_user` between time - 5m and 'roundedTime' merge as 'max usage user of the last 5 aggregate readings' using max(1)

func (*Devops) GroupByTime

func (d *Devops) GroupByTime(qi query.Query, nHosts, numMetrics int, timeRange time.Duration)

GroupByTime selects the MAX for numMetrics metrics in the group `cpu`, per minute for nhosts hosts, e.g. in pseudo-SQL:

In case of 1 metric: select max(1m) from (`groupHost1` | ...) & `groupMetric1` between 'time1' and 'time2' merge as 'max METRIC for (HOST | ... ) using max(1)

In case of multiple metrics NOTE: it is not possible to merge multiple hosts per metric for a list of metrics, only for one metric. In this case all series for the provided hosts and metrics are returned:

select max(1m) from (`groupHost1` | ...) & (`groupMetric1` | ...) between 'time1' and 'time2'

func (*Devops) GroupByTimeAndPrimaryTag

func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int)

GroupByTimeAndPrimaryTag selects the AVG of numMetrics metrics in the group `cpu` per device per hour for a day, e.g. in pseudo-SQL:

select mean(1h) from (`groupMetric1` | ...) between 'time1' and 'time2'

func (*Devops) HighCPUForHosts

func (d *Devops) HighCPUForHosts(qi query.Query, nHosts int)

HighCPUForHosts populates a query that gets CPU metrics when the CPU has high usage between a time period for a number of hosts (if 0, it will search all hosts), e.g. in pseudo-SQL:

NOTE: It is not possible to return the other cpu metrics when e.g. usage_user has reached a threshold. Here only the metric "usage_user" is returned.

nHosts=0: select filter(> 90) from `usage_user` between 'time1' and 'time2' nHosts>0: select filter(> 90) from `usage_user` & (`groupHost1` | ...) between 'time1' and 'time2'

func (*Devops) LastPointPerHost

func (d *Devops) LastPointPerHost(qi query.Query)

LastPointPerHost finds the last value of every time serie within the CPU group.

select last() from `cpu`

func (*Devops) MaxAllCPU

func (d *Devops) MaxAllCPU(qi query.Query, nHosts int)

MaxAllCPU selects the MAX of all metrics in the group `cpu` per hour for nhosts hosts, e.g. in pseudo-SQL:

NOTE: it is not possible to merge multiple hosts per metric for a list of metrics, only for one metric. In this case all series for the provided hosts and all `cpu` metrics are returned):

select max(1h) from (`groupHost1` | ...) & `cpu` between 'time1' and 'time2'

Jump to

Keyboard shortcuts

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