bulk_query_gen

package
v0.0.0-...-ffc6c44 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseName = "database-name"
)
View Source
const DefaultQueryInterval = time.Hour

Variables

View Source
var (
	TimeWindowShift   time.Duration
	QueryIntervalType string
)
View Source
var HTTPQueryPool sync.Pool = sync.Pool{
	New: func() interface{} {
		return &HTTPQuery{
			HumanLabel:       []byte{},
			HumanDescription: []byte{},
			Method:           []byte{},
			Path:             []byte{},
			Body:             []byte{},
			StartTimestamp:   0,
			EndTimestamp:     0,
		}
	},
}

Functions

func DevopsDispatchAll

func DevopsDispatchAll(d Devops, iteration int, q Query, scaleVar int)

devopsDispatchAll round-robins through the different devops queries.

func IotDispatchAll

func IotDispatchAll(d Iot, iteration int, q Query, scaleVar int)

devopsDispatchAll round-robins through the different devops queries.

Types

type CommonParams

type CommonParams struct {
	AllInterval TimeInterval
	ScaleVar    int
}

func NewCommonParams

func NewCommonParams(interval TimeInterval, scaleVar int) *CommonParams

type DatabaseConfig

type DatabaseConfig map[string]string

type Devops

type Devops interface {
	MaxCPUUsageHourByMinuteOneHost(Query)
	MaxCPUUsageHourByMinuteTwoHosts(Query)
	MaxCPUUsageHourByMinuteFourHosts(Query)
	MaxCPUUsageHourByMinuteEightHosts(Query)
	MaxCPUUsageHourByMinuteSixteenHosts(Query)
	MaxCPUUsageHourByMinuteThirtyTwoHosts(Query)

	MaxCPUUsage12HoursByMinuteOneHost(Query)

	MeanCPUUsageDayByHourAllHostsGroupbyHost(Query)

	Dispatch(int) Query
}

Devops describes a devops query generator.

type HTTPQuery

type HTTPQuery struct {
	HumanLabel       []byte
	HumanDescription []byte
	Method           []byte
	Path             []byte
	Body             []byte
	StartTimestamp   int64
	EndTimestamp     int64
}

HTTPQuery encodes an HTTP request. This will typically by serialized for use by the query_benchmarker program.

func NewHTTPQuery

func NewHTTPQuery() *HTTPQuery

func (*HTTPQuery) HumanDescriptionName

func (q *HTTPQuery) HumanDescriptionName() []byte

func (*HTTPQuery) HumanLabelName

func (q *HTTPQuery) HumanLabelName() []byte

func (*HTTPQuery) Release

func (q *HTTPQuery) Release()

func (*HTTPQuery) String

func (q *HTTPQuery) String() string

String produces a debug-ready description of a Query.

type Iot

type Iot interface {
	AverageTemperatureDayByHourOneHome(Query)

	Dispatch(int) Query
}

Devops describes a devops query generator.

type Query

type Query interface {
	Release()
	HumanLabelName() []byte
	HumanDescriptionName() []byte
	fmt.Stringer
}

type QueryGenerator

type QueryGenerator interface {
	Dispatch(int) Query
}

QueryGenerator describes a generator of queries, typically according to a use case.

type QueryGeneratorMaker

type QueryGeneratorMaker func(dbConfig DatabaseConfig, queriesFullRange TimeInterval, queryInterval time.Duration, scaleVar int) QueryGenerator

type TimeInterval

type TimeInterval struct {
	Start, End time.Time
}

TimeInterval represents an interval of time.

func NewTimeInterval

func NewTimeInterval(start, end time.Time) TimeInterval

NewTimeInterval constructs a TimeInterval.

func (*TimeInterval) Duration

func (ti *TimeInterval) Duration() time.Duration

Duration converts a TimeInterval to a time.Duration.

func (*TimeInterval) EndString

func (ti *TimeInterval) EndString() string

EndString formats the end of the time interval.

func (*TimeInterval) EndUnixNano

func (ti *TimeInterval) EndUnixNano() int64

EndUnixNano returns the end time as nanoseconds.

func (*TimeInterval) RandWindow

func (ti *TimeInterval) RandWindow(window time.Duration) TimeInterval

RandWindow creates a TimeInterval of duration `window` at a uniformly-random start time within this time interval.

func (*TimeInterval) StartString

func (ti *TimeInterval) StartString() string

StartString formats the start of the time interval.

func (*TimeInterval) StartUnixNano

func (ti *TimeInterval) StartUnixNano() int64

StartUnixNano returns the start time as nanoseconds.

type TimeWindow

type TimeWindow struct {
	Start    time.Time
	Duration time.Duration
}

func (*TimeWindow) SlidingWindow

func (tw *TimeWindow) SlidingWindow(AllInterval *TimeInterval) TimeInterval

Inspired by TimeInterval.RandWindow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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