MCPcopy
hub / github.com/uber-go/zap / SamplerHook

Function SamplerHook

zapcore/sampler.go:121–125  ·  view source on GitHub ↗

SamplerHook registers a function which will be called when Sampler makes a decision. This hook may be used to get visibility into the performance of the sampler. For example, use it to track metrics of dropped versus sampled logs. var dropped atomic.Int64 zapcore.SamplerHook(func(ent zapcore.En

(hook func(entry Entry, dec SamplingDecision))

Source from the content-addressed store, hash-verified

119// }
120// })
121func SamplerHook(hook func(entry Entry, dec SamplingDecision)) SamplerOption {
122 return optionFunc(func(s *sampler) {
123 s.hook = hook
124 })
125}
126
127// NewSamplerWithOptions creates a Core that samples incoming entries, which
128// caps the CPU and I/O load of logging while attempting to preserve a

Callers 3

buildOptionsMethod · 0.92
TestSamplerConcurrentFunction · 0.85

Calls 1

optionFuncFuncType · 0.70

Tested by 2

TestSamplerConcurrentFunction · 0.68