promql/functions.go
func funcClampMax(vals []Value, args Expressions, enh *EvalNodeHelper) Vector {
	vec := vals[0].(Vector)
	max := vals[1].(Vector)[0].Point.V
	for _, el := range vec {
		enh.out = append(enh.out, Sample{
			Metric: enh.dropMetricName(el.Metric),
			Point:  Point{V: math.Min(max, el.V)},
		})
	}
	return enh.out
}
func funcClampMax(vals []Value, args Expressions, enh *EvalNodeHelper) Vector {
	vec := vals[0].(Vector)
	max := vals[1].(Vector)[0].Point.V
	for _, el := range vec {
		enh.out = append(enh.out, Sample{
			Metric: enh.dropMetricName(el.Metric),
			Point:  Point{V: math.Min(max, el.V)},
		})
	}
	return enh.out
}
func funcClampMax ( vals [ ] Value , args Expressions , enh * EvalNodeHelper ) Vector { vec := vals [ 0 ] . ( Vector ) max := vals [ 1 ] . ( Vector ) [ 0 ] . Point . V for _ , el := range vec { enh . out = append ( enh . out , Sample { Metric : enh . dropMetricName ( el . Metric ) , Point : Point { V : math . Min ( max , el . V ) } , } ) } return enh . out }
// === clamp_max(Vector ValueTypeVector, max Scalar) Vector ===
=== clamp_max ( Vector ValueTypeVector max Scalar ) Vector ===