grpc 呼び出しが機能しない理由を理解しようとしていますが、デバッグを有効にする方法がわかりません。そのため、grpcで送受信されているデータを確認できます。接続。
Grpc呼び出しのデバッグを有効にするにはどうすればよいですか?
GRPC_TRACE
環境変数をall
に設定して、grpcに接続の実行に関するデータ全体をダンプさせることができます。
export GRPC_TRACE=all
コメントから編集:明らかにあなたも設定する必要があります:
export GRPC_VERBOSITY=DEBUG
Golangでは、HTTP-2トレース、つまりgRPCによって設定されたヘッダーを表示するには、 GODEBUG
環境変数 を設定する必要があります。
GODEBUG=http2debug=1 # enable verbose HTTP/2 debug logs
GODEBUG=http2debug=2 # ... even more verbose, with frame dumps
その後、出力はstdoutに送信されます。以下に例を示します。
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: wrote SETTINGS len=0","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: wrote WINDOW_UPDATE len=4 (conn) incr=983025","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: read SETTINGS len=18, settings: ENABLE_Push=0, MAX_CONCURRENT_STREAMS=0, INITIAL_WINDOW_SIZE=1048576","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: read WINDOW_UPDATE len=4 (conn) incr=983041","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: wrote SETTINGS flags=ACK len=0","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: read SETTINGS flags=ACK len=0","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: Framer 0xc42009c0e0: read HEADERS flags=END_HEADERS|PRIORITY stream=3 len=249","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \":authority\" = \"\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \":path\" = \"/internal.Push.v1.UnifiedDevicePush/SendMessage\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \":method\" = \"POST\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \":scheme\" = \"http\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \"content-type\" = \"application/grpc\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \"te\" = \"trailers\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \"user-agent\" = \"grpc-Java-netty/1.0.3\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \"root-common.xirequestid-bin\" = \"ChIJzE6lBfCTCsYRoIIJujc92JY=\"","time":"2017-06-11T08:52:20Z"}
{"level":"info","msg":"2017/06/11 08:52:20 http2: decoded hpack field header field \"te\" = \"trailers\"","time":"2017-06-11T08:52:20Z"}