SigNoz/signoz · error

alpha param should be a float

Error message

alpha param should be a float

What it means

EWMA's alpha must arrive as float64 or a string parseable by strconv.ParseFloat. This fires when Args[0] is neither (e.g. a non-numeric string, bool, or nil).

Source

Thrown at pkg/query-service/model/v3/v3.go:1138

					// if string, attempt to convert to float
					timeShiftBy, err := strconv.ParseFloat(function.Args[0].(string), 64)
					if err != nil {
						return fmt.Errorf("timeShiftBy param should be a number")
					}
					function.Args[0] = timeShiftBy
				}
			} else if function.Name == FunctionNameEWMA3 ||
				function.Name == FunctionNameEWMA5 ||
				function.Name == FunctionNameEWMA7 {
				if len(function.Args) == 0 {
					return fmt.Errorf("alpha param missing in query")
				}
				alpha, ok := function.Args[0].(float64)
				if !ok {
					// if string, attempt to convert to float
					alpha, err := strconv.ParseFloat(function.Args[0].(string), 64)
					if err != nil {
						return fmt.Errorf("alpha param should be a float")
					}
					function.Args[0] = alpha
				}
				if alpha < 0 || alpha > 1 {
					return fmt.Errorf("alpha param should be between 0 and 1")
				}
			} else if function.Name == FunctionNameCutOffMax ||
				function.Name == FunctionNameCutOffMin ||
				function.Name == FunctionNameClampMax ||
				function.Name == FunctionNameClampMin {
				if len(function.Args) == 0 {
					return fmt.Errorf("threshold param missing in query")
				}
				_, ok := function.Args[0].(float64)
				if !ok {
					// if string, attempt to convert to float
					if _, ok := function.Args[0].(string); !ok {
						return fmt.Errorf("threshold param should be a float")

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Send alpha as a JSON number (0.5) or numeric string ("0.5")
  2. Validate the input is numeric and within [0,1] client-side before submitting

Example fix

// before
{"name":"EWMA3","args":["zero"]}
// after
{"name":"EWMA3","args":[0.5]}
Defensive patterns

Strategy: type-guard

Validate before calling

a, err := strconv.ParseFloat(fmt.Sprint(f.Args[0]), 64); if err != nil { return errors.New("alpha must be numeric") }

Type guard

func isFloatArg(a interface{}) bool { if _, ok := a.(float64); ok { return true }; s, ok := a.(string); if !ok { return false }; _, err := strconv.ParseFloat(s, 64); return err == nil }

Prevention

When it happens

Trigger: "args":["zero"] or [null] or [true] on an EWMA function.

Common situations: Form inputs submitting unvalidated text; locale-formatted numbers ("0,5"); nulls from optional JSON fields.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/c570db7b8fc95007. Report an issue: GitHub.