Beispiel #1
0
// FilterGI installs a counter GlobalInfo filter in the context.
func FilterGI(c context.Context) (context.Context, *InfoCounter) {
	state := &InfoCounter{}
	return info.AddFilters(c, func(ic context.Context, gi info.Interface) info.Interface {
		return &infoCounter{state, gi}
	}), state
}
Beispiel #2
0
// FilterGI installs a counter info filter in the context.
func FilterGI(c context.Context, defaultError error) (context.Context, FeatureBreaker) {
	state := newState(defaultError)
	return info.AddFilters(c, func(ic context.Context, i info.Interface) info.Interface {
		return &infoState{state, i}
	}), state
}