-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobservability.go
More file actions
19 lines (15 loc) · 696 Bytes
/
observability.go
File metadata and controls
19 lines (15 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package ewrap
// Observer defines hooks for observing errors and circuit breaker state transitions.
type Observer interface {
// RecordError is called when an error is logged.
RecordError(message string)
// RecordCircuitStateTransition is called when a circuit breaker changes state.
RecordCircuitStateTransition(name string, from, to CircuitState)
}
// noopObserver provides a no-op implementation of the Observer interface.
type noopObserver struct{}
func newNoopObserver() Observer {
return noopObserver{}
}
func (noopObserver) RecordError(string) {}
func (noopObserver) RecordCircuitStateTransition(string, CircuitState, CircuitState) {}