Files
ed1ce10329 Tryout otlp collector fix for retryable http errors (#3515)
* Add test to reproduce otlp http 500s

* Bad merge

* Add scary test

* Update dependencies to use juraci's collector fork and fix

* Fix mario tests regarding otlp http limits

* vendor latest collector

Signed-off-by: Jesus Vazquez <[email protected]>

---------

Signed-off-by: Jesus Vazquez <[email protected]>
Co-authored-by: Mario <[email protected]>
2024-03-27 19:23:29 +00:00
..

circuit-breaker

Golang CI GoDoc Code of Conduct

The circuit-breaker resiliency pattern for golang.

Creating a breaker takes three parameters:

  • error threshold (for opening the breaker)
  • success threshold (for closing the breaker)
  • timeout (how long to keep the breaker open)
b := breaker.New(3, 1, 5*time.Second)

for {
	result := b.Run(func() error {
		// communicate with some external service and
		// return an error if the communication failed
		return nil
	})

	switch result {
	case nil:
		// success!
	case breaker.ErrBreakerOpen:
		// our function wasn't run because the breaker was open
	default:
		// some other error
	}
}