dongluanjie8678 2018-01-09 16:11
浏览 117
已采纳

在Go中将统计处理程序附加到gRPC

So I am using a mux that will determine what type of request is incoming (gRPC or REST) and route the request accordingly. For gRPC requests I am attaching a stats handler to collect some metadata but one of the interface methods TagRPC() which we use to tag our metadata is not being called.

app.httpMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    if isgRPC(r) {
        app.gRPCServer.ServeHTTP(w, r)
    } else {
        app.rMux.ServeHTTP(w, r)
    }
})

I think the problem is with gRPC's ServeHTTP method not supporting all the methods. If I were to attach TagGRPC() manually where would be a good place to do it?

  • 写回答

1条回答

  • dqwh1218 2018-01-09 23:56
    关注

    stats handler is not fully support in ServeHTTP Handler now.

    More details in https://github.com/grpc/grpc-go/issues/1784

    (I just noticed that you also filed the issue, but this may help other people also interested in this)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大