RPCMethod returns the method string for the server context. The returned string is in the format of "/package.service/method".
(ctx context.Context)
| 373 | // RPCMethod returns the method string for the server context. The returned |
| 374 | // string is in the format of "/package.service/method". |
| 375 | func RPCMethod(ctx context.Context) (string, bool) { |
| 376 | m := ctx.Value(rpcMethodKey{}) |
| 377 | if m == nil { |
| 378 | return "", false |
| 379 | } |
| 380 | ms, ok := m.(string) |
| 381 | if !ok { |
| 382 | return "", false |
| 383 | } |
| 384 | return ms, true |
| 385 | } |
| 386 | |
| 387 | func withRPCMethod(ctx context.Context, rpcMethodName string) context.Context { |
| 388 | return context.WithValue(ctx, rpcMethodKey{}, rpcMethodName) |
no outgoing calls