scanThresholdExpression scans a threshold condition expression of the form: `aggregation_method operator value`. An invalid or unknown operator will produce an error. However, no assertions regarding either the left-hand side aggregation method nor the right-hand side value will be made: they will b
(input string)
| 142 | // side value will be made: they will be returned as is, only trimmed from |
| 143 | // their spaces. |
| 144 | func scanThresholdExpression(input string) (string, string, string, error) { |
| 145 | for _, op := range operatorTokens { |
| 146 | left, right, _ := strings.Cut(input, op) |
| 147 | if right != "" { |
| 148 | return strings.TrimSpace(left), op, strings.TrimSpace(right), nil |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | return "", "", "", fmt.Errorf("malformed threshold expression") |
| 153 | } |
| 154 | |
| 155 | // Define accepted threshold expression aggregation tokens |
| 156 | // Percentile token `p(..)` is accepted too but handled separately. |
searching dependent graphs…