我正在使用 stats/HandleRPC() 发出一些关于 RPC 持续时间的指标,当我收到 stats/End 数据时,我想用一些可以从传入和传出有效负载中提取的信息来标记这些指标。实现这一目标的最佳方法是什么?
func (h *myStatsHandler) HandleRPC(ctx context.Context, rpcStats stats.RPCStats) {
switch stat := rpcStats.(type) {
case *stats.End:
durationMs := stat.EndTime.Sub(stat.BeginTime).Seconds() * 1000.0
// Now before sending this value, I need to know, for example the value of a specific key in the request payload, or whether the response is nil or not
}
}
撒科打诨
相关分类