Example #1
0
func init() {
	// Arithmetic operators
	MustRegister(NewOperator("+", func(x float64, y float64) float64 { return x + y }))
	MustRegister(NewOperator("-", func(x float64, y float64) float64 { return x - y }))
	MustRegister(NewOperator("*", func(x float64, y float64) float64 { return x * y }))
	MustRegister(NewOperator("/", func(x float64, y float64) float64 { return x / y }))
	// Aggregates
	MustRegister(NewAggregate("aggregate.max", aggregate.Max))
	MustRegister(NewAggregate("aggregate.min", aggregate.Min))
	MustRegister(NewAggregate("aggregate.mean", aggregate.Mean))
	MustRegister(NewAggregate("aggregate.sum", aggregate.Sum))
	// Transformations
	MustRegister(NewTransform("transform.derivative", 0, transform.Derivative))
	MustRegister(NewTransform("transform.integral", 0, transform.Integral))
	MustRegister(NewTransform("transform.rate", 0, transform.Rate))
	MustRegister(NewTransform("transform.cumulative", 0, transform.Cumulative))
	MustRegister(NewTransform("transform.default", 1, transform.Default))
	MustRegister(NewTransform("transform.abs", 0, transform.MapMaker(math.Abs)))
	MustRegister(NewTransform("transform.log", 0, transform.MapMaker(math.Log10)))
	MustRegister(NewTransform("transform.nan_keep_last", 0, transform.NaNKeepLast))
	// Filter
	MustRegister(NewFilter("filter.highest_mean", aggregate.Mean, false))
	MustRegister(NewFilter("filter.lowest_mean", aggregate.Mean, true))
	MustRegister(NewFilter("filter.highest_max", aggregate.Max, false))
	MustRegister(NewFilter("filter.lowest_max", aggregate.Max, true))
	MustRegister(NewFilter("filter.highest_min", aggregate.Min, false))
	MustRegister(NewFilter("filter.lowest_min", aggregate.Min, true))
	// Weird ones
	MustRegister(transform.Timeshift)
	MustRegister(transform.Alias)
	MustRegister(transform.MovingAverage)
}
Example #2
0
func init() {
	// Arithmetic operators
	MustRegister(NewOperator("+", func(x float64, y float64) float64 { return x + y }))
	MustRegister(NewOperator("-", func(x float64, y float64) float64 { return x - y }))
	MustRegister(NewOperator("*", func(x float64, y float64) float64 { return x * y }))
	MustRegister(NewOperator("/", func(x float64, y float64) float64 { return x / y }))
	// Aggregates
	MustRegister(NewAggregate("aggregate.max", aggregate.Max))
	MustRegister(NewAggregate("aggregate.min", aggregate.Min))
	MustRegister(NewAggregate("aggregate.mean", aggregate.Mean))
	MustRegister(NewAggregate("aggregate.sum", aggregate.Sum))
	MustRegister(NewAggregate("aggregate.total", aggregate.Total))
	MustRegister(NewAggregate("aggregate.count", aggregate.Count))
	// Transformations
	MustRegister(NewTransform("transform.integral", 0, transform.Integral))
	MustRegister(NewTransform("transform.cumulative", 0, transform.Cumulative))
	MustRegister(NewTransform("transform.nan_fill", 1, transform.Default))
	MustRegister(NewTransform("transform.abs", 0, transform.MapMaker(math.Abs)))
	MustRegister(NewTransform("transform.log", 0, transform.MapMaker(math.Log10)))
	MustRegister(NewTransform("transform.nan_keep_last", 0, transform.NaNKeepLast))
	MustRegister(NewTransform("transform.bound", 2, transform.Bound))
	MustRegister(NewTransform("transform.lower_bound", 1, transform.LowerBound))
	MustRegister(NewTransform("transform.upper_bound", 1, transform.UpperBound))
	// Filter
	MustRegister(NewFilter("filter.highest_mean", aggregate.Mean, false))
	MustRegister(NewFilter("filter.lowest_mean", aggregate.Mean, true))
	MustRegister(NewFilter("filter.highest_max", aggregate.Max, false))
	MustRegister(NewFilter("filter.lowest_max", aggregate.Max, true))
	MustRegister(NewFilter("filter.highest_min", aggregate.Min, false))
	MustRegister(NewFilter("filter.lowest_min", aggregate.Min, true))
	// Filter Recent
	MustRegister(NewFilterRecent("filter.recent_highest_mean", aggregate.Mean, false))
	MustRegister(NewFilterRecent("filter.recent_lowest_mean", aggregate.Mean, true))
	MustRegister(NewFilterRecent("filter.recent_highest_max", aggregate.Max, false))
	MustRegister(NewFilterRecent("filter.recent_lowest_max", aggregate.Max, true))
	MustRegister(NewFilterRecent("filter.recent_highest_min", aggregate.Min, false))
	MustRegister(NewFilterRecent("filter.recent_lowest_min", aggregate.Min, true))
	// Weird ones
	MustRegister(transform.Alias)
	MustRegister(transform.Derivative)
	MustRegister(transform.MovingAverage)
	MustRegister(transform.Rate)
	MustRegister(transform.Timeshift)
	// Tags
	MustRegister(tag.DropFunction)
	MustRegister(tag.SetFunction)
	// Forecasting
	MustRegister(forecast.FunctionRollingMultiplicativeHoltWinters)
	MustRegister(forecast.FunctionAnomalyRollingMultiplicativeHoltWinters)
	MustRegister(forecast.FunctionRollingSeasonal)
	MustRegister(forecast.FunctionAnomalyRollingSeasonal)
	MustRegister(forecast.FunctionForecastLinear)

	MustRegister(forecast.FunctionDrop)
}