Files
cloud-services/pkg/health/goroutines.go

19 lines
325 B
Go

package health
import (
"context"
"runtime"
"github.com/pkg/errors"
)
func NewGoRoutinesCheck(threshold int) CheckFunc {
return func(ctx context.Context) error {
count := runtime.NumGoroutine()
if count > threshold {
return errors.Errorf("too many goroutines (%d > %d)", count, threshold)
}
return nil
}
}