Documentation ¶
Index ¶
- type BaseGenerator
- type Devops
- func (d *Devops) GroupByOrderByLimit(qi query.Query)
- func (d *Devops) GroupByTime(qi query.Query, nHosts, numMetrics int, timeRange time.Duration)
- func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int)
- func (d *Devops) HighCPUForHosts(qi query.Query, nHosts int)
- func (d *Devops) LastPointPerHost(qi query.Query)
- func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration)
- type IoT
- func (i *IoT) AvgDailyDrivingDuration(qi query.Query)
- func (i *IoT) AvgDailyDrivingSession(qi query.Query)
- func (i *IoT) AvgLoad(qi query.Query)
- func (i *IoT) AvgVsProjectedFuelConsumption(qi query.Query)
- func (i *IoT) DailyTruckActivity(qi query.Query)
- func (i *IoT) LastLocByTruck(qi query.Query, nTrucks int)
- func (i *IoT) LastLocPerTruck(qi query.Query)
- func (i *IoT) StationaryTrucks(qi query.Query)
- func (i *IoT) TruckBreakdownFrequency(qi query.Query)
- func (i *IoT) TrucksWithHighLoad(qi query.Query)
- func (i *IoT) TrucksWithLongDailySessions(qi query.Query)
- func (i *IoT) TrucksWithLongDrivingSessions(qi query.Query)
- func (i *IoT) TrucksWithLowFuel(qi query.Query)
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 Influx database.
func (*BaseGenerator) GenerateEmptyQuery ¶
func (g *BaseGenerator) GenerateEmptyQuery() query.Query
GenerateEmptyQuery returns an empty query.HTTP.
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.
func (*BaseGenerator) NewIoT ¶
func (g *BaseGenerator) NewIoT(start, end time.Time, scale int) (utils.QueryGenerator, error)
NewIoT creates a new iot use case query generator.
type Devops ¶
type Devops struct { *BaseGenerator *devops.Core }
Devops produces Influx-specific queries for all the devops query types.
func (*Devops) GroupByOrderByLimit ¶
GroupByOrderByLimit benchmarks a query that has a time WHERE clause, that groups by a truncated date, orders by that date, and takes a limit: SELECT date_trunc('minute', time) AS t, MAX(cpu) FROM cpu WHERE time < '$TIME' GROUP BY t ORDER BY t DESC LIMIT $LIMIT
func (*Devops) GroupByTime ¶
GroupByTime selects the MAX for numMetrics metrics under 'cpu', per minute for nhosts hosts, e.g. in pseudo-SQL:
SELECT minute, max(metric1), ..., max(metricN) FROM cpu WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N') AND time >= '$HOUR_START' AND time < '$HOUR_END' GROUP BY minute ORDER BY minute ASC
func (*Devops) GroupByTimeAndPrimaryTag ¶
GroupByTimeAndPrimaryTag selects the AVG of numMetrics metrics under 'cpu' per device per hour for a day, e.g. in pseudo-SQL:
SELECT AVG(metric1), ..., AVG(metricN) FROM cpu WHERE time >= '$HOUR_START' AND time < '$HOUR_END' GROUP BY hour, hostname ORDER BY hour, hostname
func (*Devops) HighCPUForHosts ¶
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:
SELECT * FROM cpu WHERE usage_user > 90.0 AND time >= '$TIME_START' AND time < '$TIME_END' AND (hostname = '$HOST' OR hostname = '$HOST2'...)
func (*Devops) LastPointPerHost ¶
LastPointPerHost finds the last row for every host in the dataset
func (*Devops) MaxAllCPU ¶
MaxAllCPU selects the MAX of all metrics under 'cpu' per hour for nhosts hosts, e.g. in pseudo-SQL:
SELECT MAX(metric1), ..., MAX(metricN) FROM cpu WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N') AND time >= '$HOUR_START' AND time < '$HOUR_END' GROUP BY hour ORDER BY hour
type IoT ¶
type IoT struct { *iot.Core *BaseGenerator }
IoT produces Influx-specific queries for all the iot query types.
func NewIoT ¶
func NewIoT(start, end time.Time, scale int, g *BaseGenerator) *IoT
NewIoT makes an IoT object ready to generate Queries.
func (*IoT) AvgDailyDrivingDuration ¶
AvgDailyDrivingDuration finds the average driving duration per driver.
func (*IoT) AvgDailyDrivingSession ¶
AvgDailyDrivingSession finds the average driving session without stopping per driver per day.
func (*IoT) AvgVsProjectedFuelConsumption ¶
AvgVsProjectedFuelConsumption calculates average and projected fuel consumption per fleet.
func (*IoT) DailyTruckActivity ¶
DailyTruckActivity returns the number of hours trucks has been active (not out-of-commission) per day per fleet per model.
func (*IoT) LastLocByTruck ¶
LastLocByTruck finds the truck location for nTrucks.
func (*IoT) LastLocPerTruck ¶
LastLocPerTruck finds all the truck locations along with truck and driver names.
func (*IoT) StationaryTrucks ¶
StationaryTrucks finds all trucks that have low average velocity in a time window.
func (*IoT) TruckBreakdownFrequency ¶
TruckBreakdownFrequency calculates the amount of times a truck model broke down in the last period.
func (*IoT) TrucksWithHighLoad ¶
TrucksWithHighLoad finds all trucks that have load over 90%.
func (*IoT) TrucksWithLongDailySessions ¶
TrucksWithLongDailySessions finds all trucks that have driven more than 10 hours in the last 24 hours.
func (*IoT) TrucksWithLongDrivingSessions ¶
TrucksWithLongDrivingSessions finds all trucks that have not stopped at least 20 mins in the last 4 hours.
func (*IoT) TrucksWithLowFuel ¶
TrucksWithLowFuel finds all trucks with low fuel (less than 10%).