github.com/go-graphite/carbonapi@v0.17.0/expr/functions/holtWintersConfidenceArea/function.go (about)

     1  //go:build !cairo
     2  // +build !cairo
     3  
     4  package holtWintersConfidenceArea
     5  
     6  import (
     7  	"context"
     8  	"fmt"
     9  
    10  	"github.com/go-graphite/carbonapi/expr/interfaces"
    11  	"github.com/go-graphite/carbonapi/expr/types"
    12  	"github.com/go-graphite/carbonapi/pkg/parser"
    13  )
    14  
    15  var UnsupportedError = fmt.Errorf("must build w/ cairo support")
    16  
    17  type holtWintersConfidenceArea struct{}
    18  
    19  func GetOrder() interfaces.Order {
    20  	return interfaces.Any
    21  }
    22  
    23  func New(_ string) []interfaces.FunctionMetadata {
    24  	res := make([]interfaces.FunctionMetadata, 0)
    25  
    26  	f := &holtWintersConfidenceArea{}
    27  	functions := []string{"holtWintersConfidenceArea"}
    28  	for _, n := range functions {
    29  		res = append(res, interfaces.FunctionMetadata{Name: n, F: f})
    30  	}
    31  
    32  	return res
    33  }
    34  
    35  func (f *holtWintersConfidenceArea) Do(_ context.Context, _ interfaces.Evaluator, _ parser.Expr, _, _ int64, _ map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error) {
    36  	return nil, UnsupportedError
    37  }
    38  
    39  // Description is auto-generated description, based on output of https://github.com/graphite-project/graphite-web
    40  func (f *holtWintersConfidenceArea) Description() map[string]types.FunctionDescription {
    41  	return map[string]types.FunctionDescription{
    42  		"holtWintersConfidenceArea": {
    43  			Description: "Performs a Holt-Winters forecast using the series as input data and plots\n the area between the upper and lower bands of the predicted forecast deviations.",
    44  			Function:    "holtWintersConfidenceArea(seriesList, delta=3, bootstrapInterval='7d')",
    45  			Group:       "Calculate",
    46  			Module:      "graphite.render.functions",
    47  			Name:        "holtWintersConfidenceArea",
    48  			Params: []types.FunctionParam{
    49  				{
    50  					Name:     "seriesList",
    51  					Required: true,
    52  					Type:     types.SeriesList,
    53  				},
    54  				{
    55  					Default: types.NewSuggestion(3),
    56  					Name:    "delta",
    57  					Type:    types.Integer,
    58  				},
    59  				{
    60  					Default: types.NewSuggestion("7d"),
    61  					Name:    "bootstrapInterval",
    62  					Suggestions: types.NewSuggestions(
    63  						"7d",
    64  						"30d",
    65  					),
    66  					Type: types.Interval,
    67  				},
    68  			},
    69  		},
    70  	}
    71  }