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)

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

报告相同问题?

悬赏问题

  • ¥50 汇编语言除法溢出问题
  • ¥65 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗