MCPcopy
hub / github.com/grpc/grpc-go / StatsHandler

Function StatsHandler

server.go:542–552  ·  view source on GitHub ↗

StatsHandler returns a ServerOption that sets the stats handler for the server.

(h stats.Handler)

Source from the content-addressed store, hash-verified

540
541// StatsHandler returns a ServerOption that sets the stats handler for the server.
542func StatsHandler(h stats.Handler) ServerOption {
543 return newFuncServerOption(func(o *serverOptions) {
544 if h == nil {
545 logger.Error("ignoring nil parameter in grpc.StatsHandler ServerOption")
546 // Do not allow a nil stats handler, which would otherwise cause
547 // panics.
548 return
549 }
550 o.statsHandlers = append(o.statsHandlers, h)
551 })
552}
553
554// binaryLogger returns a ServerOption that can set the binary logger for the
555// server.

Callers 6

TestNilStatsHandlerMethod · 0.92
mainFunction · 0.92
startServerMethod · 0.92
ServerOptionFunction · 0.92
ServerOptionFunction · 0.92

Calls 2

newFuncServerOptionFunction · 0.85
ErrorMethod · 0.65

Tested by 3

TestNilStatsHandlerMethod · 0.74
startServerMethod · 0.74