|
@@ -83,6 +83,10 @@ struct l7_event {
|
|
|
__u16 dport;
|
|
__u16 dport;
|
|
|
__u8 saddr[16];
|
|
__u8 saddr[16];
|
|
|
__u8 daddr[16];
|
|
__u8 daddr[16];
|
|
|
|
|
+ __u16 component_sport;
|
|
|
|
|
+ __u16 component_dport;
|
|
|
|
|
+ __u8 component_saddr[16];
|
|
|
|
|
+ __u8 component_daddr[16];
|
|
|
unsigned char assumed_app_id[APM_ASSUMED_APP_ID_SIZE];
|
|
unsigned char assumed_app_id[APM_ASSUMED_APP_ID_SIZE];
|
|
|
unsigned char span_id[APM_SPAN_ID_SIZE];
|
|
unsigned char span_id[APM_SPAN_ID_SIZE];
|
|
|
unsigned char trace_id_from[APM_TRACE_ID_SIZE];
|
|
unsigned char trace_id_from[APM_TRACE_ID_SIZE];
|
|
@@ -907,6 +911,11 @@ int trace_exit_read(void *ctx, __u64 id, __u32 pid, __u16 is_tls, long int ret)
|
|
|
if (e->protocol == PROTOCOL_HTTP) {
|
|
if (e->protocol == PROTOCOL_HTTP) {
|
|
|
__u64 trace_id = req->trace_id;
|
|
__u64 trace_id = req->trace_id;
|
|
|
e->trace_id = trace_id;
|
|
e->trace_id = trace_id;
|
|
|
|
|
+ // cw_bpf_debug("l7.c addr is --------:%d,%s,%d,%s",conn->sport,conn->saddr,conn->dport,conn->daddr);
|
|
|
|
|
+ e->component_sport = conn->sport;
|
|
|
|
|
+ e->component_dport = conn->dport;
|
|
|
|
|
+ __builtin_memcpy(&e->component_saddr, &conn->saddr, sizeof(e->component_saddr));
|
|
|
|
|
+ __builtin_memcpy(&e->component_daddr, &conn->daddr, sizeof(e->component_daddr));
|
|
|
// struct apm_span_context * sc = cw_get_current_tracking_span();
|
|
// struct apm_span_context * sc = cw_get_current_tracking_span();
|
|
|
// if (sc) {
|
|
// if (sc) {
|
|
|
cw_copy_byte_arrays(req->assumed_app_id, e->assumed_app_id, APM_ASSUMED_APP_ID_SIZE);
|
|
cw_copy_byte_arrays(req->assumed_app_id, e->assumed_app_id, APM_ASSUMED_APP_ID_SIZE);
|
|
@@ -938,6 +947,10 @@ int trace_exit_read(void *ctx, __u64 id, __u32 pid, __u16 is_tls, long int ret)
|
|
|
__u64 trace_id = get_apm_trace_id(pid, tid);
|
|
__u64 trace_id = get_apm_trace_id(pid, tid);
|
|
|
cw_bpf_debug("[Redis] trace_id:%llu", trace_id);
|
|
cw_bpf_debug("[Redis] trace_id:%llu", trace_id);
|
|
|
e->trace_id = trace_id;
|
|
e->trace_id = trace_id;
|
|
|
|
|
+ e->component_sport = conn->sport;
|
|
|
|
|
+ e->component_dport = conn->dport;
|
|
|
|
|
+ __builtin_memcpy(&e->component_saddr, &conn->saddr, sizeof(e->component_saddr));
|
|
|
|
|
+ __builtin_memcpy(&e->component_daddr, &conn->daddr, sizeof(e->component_daddr));
|
|
|
response = is_redis_response(payload, ret, &e->status);
|
|
response = is_redis_response(payload, ret, &e->status);
|
|
|
} else if (e->protocol == PROTOCOL_MEMCACHED) {
|
|
} else if (e->protocol == PROTOCOL_MEMCACHED) {
|
|
|
response = is_memcached_response(payload, ret, &e->status);
|
|
response = is_memcached_response(payload, ret, &e->status);
|
|
@@ -946,6 +959,10 @@ int trace_exit_read(void *ctx, __u64 id, __u32 pid, __u16 is_tls, long int ret)
|
|
|
__u64 trace_id = get_apm_trace_id(pid, tid);
|
|
__u64 trace_id = get_apm_trace_id(pid, tid);
|
|
|
// cw_bpf_debug("[Mysql] trace_id:%llu", trace_id);
|
|
// cw_bpf_debug("[Mysql] trace_id:%llu", trace_id);
|
|
|
e->trace_id = trace_id;
|
|
e->trace_id = trace_id;
|
|
|
|
|
+ e->component_sport = conn->sport;
|
|
|
|
|
+ e->component_dport = conn->dport;
|
|
|
|
|
+ __builtin_memcpy(&e->component_saddr, &conn->saddr, sizeof(e->component_saddr));
|
|
|
|
|
+ __builtin_memcpy(&e->component_daddr, &conn->daddr, sizeof(e->component_daddr));
|
|
|
response = is_mysql_response(payload, ret, req->request_type, &e->statement_id, &e->status);
|
|
response = is_mysql_response(payload, ret, req->request_type, &e->statement_id, &e->status);
|
|
|
if (req->request_type == MYSQL_COM_STMT_PREPARE) {
|
|
if (req->request_type == MYSQL_COM_STMT_PREPARE) {
|
|
|
e->method = METHOD_STATEMENT_PREPARE;
|
|
e->method = METHOD_STATEMENT_PREPARE;
|
|
@@ -1080,6 +1097,10 @@ int trace_exit_read(void *ctx, __u64 id, __u32 pid, __u16 is_tls, long int ret)
|
|
|
|
|
|
|
|
__u64 trace_id = get_apm_trace_id(pid, tid);
|
|
__u64 trace_id = get_apm_trace_id(pid, tid);
|
|
|
e->trace_id = trace_id;
|
|
e->trace_id = trace_id;
|
|
|
|
|
+ e->component_sport = conn->sport;
|
|
|
|
|
+ e->component_dport = conn->dport;
|
|
|
|
|
+ __builtin_memcpy(&e->component_saddr, &conn->saddr, sizeof(e->component_saddr));
|
|
|
|
|
+ __builtin_memcpy(&e->component_daddr, &conn->daddr, sizeof(e->component_daddr));
|
|
|
// cw_bpf_debug("[Response][DM] trace_id:%llu", trace_id);
|
|
// cw_bpf_debug("[Response][DM] trace_id:%llu", trace_id);
|
|
|
|
|
|
|
|
response = is_dm_response(payload, ret, req->request_type, &dm_ctx->status);
|
|
response = is_dm_response(payload, ret, req->request_type, &dm_ctx->status);
|