StatsHandler returns a ServerOption that sets the stats handler for the server.
(h stats.Handler)
| 540 | |
| 541 | // StatsHandler returns a ServerOption that sets the stats handler for the server. |
| 542 | func 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. |