Skip to content

Commit 65c6a24

Browse files
committed
format comment in grpc
Signed-off-by: JayiceZ <[email protected]>
1 parent 78ac614 commit 65c6a24

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

app/vtinsert/opentelemetry/grpc.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ const (
3131
GrpcUnauthenticated = "16"
3232
)
3333

34+
// +------------+---------------------------------------------+
35+
// | 1 byte | 4 bytes |
36+
// +------------+---------------------------------------------+
37+
// | Compressed | Message Length |
38+
// | Flag | (uint32) |
39+
// +------------+---------------------------------------------+
40+
// | |
41+
// | Message Data |
42+
// | (variable length) |
43+
// | |
44+
// +----------------------------------------------------------+
45+
// See https://grpc.github.io/grpc/core/md_doc__p_r_o_t_o_c_o_l-_h_t_t_p2.html
3446
func getProtobufData(r *http.Request) ([]byte, error) {
3547
reqBody, err := io.ReadAll(r.Body)
3648
if err != nil {
3749
return nil, &httpserver.ErrorWithStatusCode{StatusCode: http.StatusInternalServerError, Err: fmt.Errorf("cannot read request body: %s", err)}
3850
}
39-
// +--------+-------------------------------------------------+
40-
// | 1 byte | 4 bytes |
41-
// +--------+-------------------------------------------------+
42-
// | Compressed | Message Length |
43-
// | Flag | (uint32) |
44-
// +------------+---------------------------------------------+
45-
// | |
46-
// | Message Data |
47-
// | (variable length) |
48-
// | |
49-
// +----------------------------------------------------------+
50-
// See https://grpc.github.io/grpc/core/md_doc__p_r_o_t_o_c_o_l-_h_t_t_p2.html
5151
if len(reqBody) < 5 {
5252
return nil, &httpserver.ErrorWithStatusCode{StatusCode: http.StatusBadRequest, Err: fmt.Errorf("invalid grpc header length: %d", len(reqBody))}
5353
}

0 commit comments

Comments
 (0)