SigNoz/signoz · error

alpha param should be between 0 and 1

Error message

alpha param should be between 0 and 1

What it means

EWMA's alpha is a smoothing factor that must lie in [0,1]. After normalizing Args[0] to a float, Validate() rejects values <0 or >1 with this message.

Source

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

					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")
					}
					threshold, err := strconv.ParseFloat(function.Args[0].(string), 64)
					if err != nil {
						return fmt.Errorf("threshold param should be a float")
					}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Use a value in [0,1]; if you meant a percentage, divide by 100
  2. Clamp alpha client-side before sending

Example fix

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

Strategy: validation

Validate before calling

if alpha < 0 || alpha > 1 { return errors.New("alpha must be within [0,1]") }

Type guard

func isValidAlpha(a float64) bool { return a >= 0 && a <= 1 }

Prevention

When it happens

Trigger: "args":[1.5] or ["-0.2"] on EWMA3/EWMA5/EWMA7.

Common situations: Users entering a percentage (e.g. 50 instead of 0.5) or a window size; copy-pasted values from other tools with different alpha semantics.

Related errors


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