Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] micro-service use gRPC-Gateway, the client send http request to grpc, the request resolve status is unknown #8168

Open
3 tasks done
Fancyki1 opened this issue Sep 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Fancyki1
Copy link

Fancyki1 commented Sep 19, 2024

Search before asking

  • I had searched in the issues and found no similar feature requirement.

DeepFlow Component

Agent

What you expected to happen

背景: k8s环境中,有部分微服务使用了gRPC-Gateway发送http内部转grpc请求
结论: deepflow可以采集到http的请求内容,但是无法采集和解析grpc请求,响应状态为unknown
使用组件: https://github.com/grpc-ecosystem/grpc-gateway
组件原理:

image
请求拓扑:

image
代码实现:
定义一个grpc接口文件

syntax = "proto3";

option go_package=".;sys_time";

package sys_time;

import "google/api/annotations.proto";

message GetCurrSysTimeReq {

}

message GetCurrSysTimeRsp {
    message Data {
        int64 timeStamp = 1;
    }
    uint32 code = 1;
    string msg = 2;
    Data data = 3;
}

service SysTime {
    // 获取当前系统时间
    rpc GetCurrSysTime(GetCurrSysTimeReq) returns (GetCurrSysTimeRsp) {
	option (google.api.http) = {
            get: "/api/v1/currSysTime",
        };
    }
}

golang代码实现

// ...
func (sysTimeServer *SysTimeServer) GetCurrSysTime(ctx context.Context,req *sys_time.GetCurrSysTimeReq) (*sys_time.GetCurrSysTimeRsp, error) {
	currentTime := time.Now()
	milliSeconds := currentTime.UnixMilli()

	return &sys_time.GetCurrSysTimeRsp{
		Code: APISuccess.HttpCode,
		Msg:  APISuccess.Code,
		Data: &sys_time.GetCurrSysTimeRsp_Data{
			TimeStamp: milliSeconds,
		},
	}, nil
}
// ...

deepflow可观测结果
image

前端gateway->micro-service:http请求采集正常
micro-service->grpc gateway->grpc server: grpc请求采集异常
经过grpc gateway采集的grpc请求状态都为unknown无法解析

经过测试: 重启服务后,采集的一段时间内,请求结果是成功了,之后又全部unknown了

另外: 采用开启uprobe后,请求的状态获取正常,但是uprobe配合extra-log-fields自定义头采集,开启后短暂时间内可以采集到自定义头部,明显unknown大量减少,但是过了30秒后自定义头部就采集不到了,我们尝试在agent rust源代码处理的位置打了log,重新编译agent部署测试,过了大概30秒后,发现ebpf内核采集的数据到了rust用户态处理的阶段自定义header数据就没了,这个会有另一个issue去记录。

@sharang @yinjiping

How to reproduce

No response

DeepFlow version

kubectl exec -it -n deepflow deploy/deepflow-server -- deepflow-server -v

Name: deepflow-server community edition
Branch: v6.5
CommitID: 9cefc731a5577fdbf67ec1196cef037b28abbe88
RevCount: 10866
Compiler: go version go1.21.13 linux/amd64
CompileTime: 2024-08-30 09:40:53

kubectl exec -it -n deepflow ds/deepflow-agent -- deepflow-agent -v

Defaulted container "deepflow-agent" out of: deepflow-agent, configure-sysctl (init)
10841-e0a10484155463453b61b20bd5fcd6222d59f829
Name: deepflow-agent community edition
Branch: v6.5
CommitId: e0a10484155463453b61b20bd5fcd6222d59f829
RevCount: 10841
Compiler: rustc 1.77.1 (7cf61ebde 2024-03-27)
CompileTime: 2024-08-18 14:17:18

DeepFlow agent list

No response

Kubernetes CNI

No response

Operation-System/Kernel version

4.18.0-372.32.1.90.po1.x86_64

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@Fancyki1 Fancyki1 added the bug Something isn't working label Sep 19, 2024
@Fancyki1 Fancyki1 changed the title [BUG] micro-service use grpcgateway send grpc request to itself, but the request resolve status is unknown [BUG] micro-service use grpcgateway send http request to grpc, but the request resolve status is unknown Sep 19, 2024
@Fancyki1 Fancyki1 changed the title [BUG] micro-service use grpcgateway send http request to grpc, but the request resolve status is unknown [BUG] micro-service use grpcgateway send http request to grpc, the request resolve status is unknown Sep 19, 2024
@Fancyki1 Fancyki1 changed the title [BUG] micro-service use grpcgateway send http request to grpc, the request resolve status is unknown [BUG] micro-service use gRPC-Gateway component, the client send http request to grpc, the request resolve status is unknown Sep 19, 2024
@Fancyki1 Fancyki1 changed the title [BUG] micro-service use gRPC-Gateway component, the client send http request to grpc, the request resolve status is unknown [BUG] micro-service use gRPC-Gateway, the client send http request to grpc, the request resolve status is unknown Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants