func()

in tester/constraint.go [41:58]


func (c *Constraint) Check(start time.Time, duration time.Duration) error {
	points, err := c.Metric.Fetch(start, duration)
	if err != nil {
		//nolint:wrapcheck
		return err
	}

	if points == nil {
		return ErrNoDataPoints
	}

	value := c.Aggregator.Aggregate(points)
	if !c.Comparator.Compare(value, c.Threshold) {
		return fmt.Errorf("%w: %.4f %s %.4f", ErrNotSatisfied, value, c.Comparator.Name(), c.Threshold)
	}

	return nil
}