|
|
@@ -138,7 +138,7 @@ struct tcp_addr {
|
|
|
|
|
|
static __always_inline int build_contxet_header(struct kafka_header_t *header, struct apm_span_context *span_ctx) {
|
|
|
if (header == NULL || span_ctx == NULL) {
|
|
|
- bpf_printk("build_contxt_header: Invalid arguments");
|
|
|
+ cw_bpf_debug("build_contxt_header: Invalid arguments");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
@@ -146,7 +146,7 @@ static __always_inline int build_contxet_header(struct kafka_header_t *header, s
|
|
|
u32 temp_strings_id = 0;
|
|
|
struct kafka_temp_strings_t *temp_strings = bpf_map_lookup_elem(&kafka_temp_strings_storage_map, &temp_strings_id);
|
|
|
if (temp_strings == NULL) {
|
|
|
- bpf_printk("build_contxt_header: Failed to get temp strings storage");
|
|
|
+ cw_bpf_debug("build_contxt_header: Failed to get temp strings storage");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
@@ -154,7 +154,7 @@ static __always_inline int build_contxet_header(struct kafka_header_t *header, s
|
|
|
__u32 tgid = pid_tgid >> 32;
|
|
|
struct ebpf_proc_info *proc_info = bpf_map_lookup_elem(&proc_info_map, &tgid);
|
|
|
if (proc_info == NULL) {
|
|
|
- bpf_printk("uprobe/WriteMessages: proc_info is NULL");
|
|
|
+ cw_bpf_debug("uprobe/WriteMessages: proc_info is NULL");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -162,7 +162,7 @@ static __always_inline int build_contxet_header(struct kafka_header_t *header, s
|
|
|
__builtin_memcpy(temp_strings->key, CW_HEADER_KEY_VAL, CW_HEADER_KEY_LENGTH);
|
|
|
void *ptr = cw_write_target_data(temp_strings->key, CW_HEADER_KEY_LENGTH, proc_info);
|
|
|
if (ptr == NULL) {
|
|
|
- bpf_printk("build_contxt_header: Failed to write key to user");
|
|
|
+ cw_bpf_debug("build_contxt_header: Failed to write key to user");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
@@ -199,10 +199,10 @@ static __always_inline int build_contxet_header(struct kafka_header_t *header, s
|
|
|
|
|
|
span_context_to_cw_string(span_ctx, temp_strings->val);
|
|
|
|
|
|
- bpf_printk("%s",temp_strings->val);
|
|
|
+ cw_bpf_debug("%s",temp_strings->val);
|
|
|
ptr = cw_write_target_data(temp_strings->val, CW_HEADER_VAL_LENGTH, proc_info);
|
|
|
if (ptr == NULL) {
|
|
|
- bpf_printk("build_contxt_header: Failed to write value to user");
|
|
|
+ cw_bpf_debug("build_contxt_header: Failed to write value to user");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
@@ -210,7 +210,7 @@ static __always_inline int build_contxet_header(struct kafka_header_t *header, s
|
|
|
header->value.array = ptr;
|
|
|
header->value.len = CW_HEADER_VAL_LENGTH;
|
|
|
header->value.cap = CW_HEADER_VAL_LENGTH;
|
|
|
- bpf_printk("build_contxt_header success");
|
|
|
+ cw_bpf_debug("build_contxt_header success");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -249,7 +249,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
|
|
|
void *kafka_request_ptr = bpf_map_lookup_elem(&kafka_events, &key);
|
|
|
if (kafka_request_ptr != NULL) {
|
|
|
- bpf_printk("uprobe/WriteMessages already tracked with the current context");
|
|
|
+ cw_bpf_debug("uprobe/WriteMessages already tracked with the current context");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -258,7 +258,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
__u32 tgid = pid_tgid >> 32;
|
|
|
struct ebpf_proc_info *proc_info = bpf_map_lookup_elem(&proc_info_map, &tgid);
|
|
|
if (proc_info == NULL) {
|
|
|
- bpf_printk("uprobe/WriteMessages: proc_info is NULL");
|
|
|
+ cw_bpf_debug("uprobe/WriteMessages: proc_info is NULL");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -266,7 +266,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
u32 zero_id = 0;
|
|
|
struct kafka_request_t *zero_kafka_request = bpf_map_lookup_elem(&kafka_request_storage_map, &zero_id);
|
|
|
if (zero_kafka_request == NULL) {
|
|
|
- bpf_printk("uuprobe/WriteMessages: zero_kafka_request is NULL");
|
|
|
+ cw_bpf_debug("uuprobe/WriteMessages: zero_kafka_request is NULL");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -276,7 +276,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
// Get a pointer to the zeroed span
|
|
|
struct kafka_request_t *kafka_request = bpf_map_lookup_elem(&kafka_request_storage_map, &actual_id);
|
|
|
if (kafka_request == NULL) {
|
|
|
- bpf_printk("uprobe/WriteMessages: Failed to get kafka_request");
|
|
|
+ cw_bpf_debug("uprobe/WriteMessages: Failed to get kafka_request");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -307,7 +307,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
// }
|
|
|
|
|
|
// u64 size_to_read = user_str.len > 22 ? 22 : user_str.len;
|
|
|
-// bpf_printk("%s",user_str.str);
|
|
|
+// cw_bpf_debug("%s",user_str.str);
|
|
|
// return 0;
|
|
|
// success = bpf_probe_read(dst, size_to_read, user_str.str);
|
|
|
|
|
|
@@ -330,14 +330,14 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
// __builtin_memset(assumed_app_id, 0, sizeof(assumed_app_id));
|
|
|
//
|
|
|
// set_app_id_numeric16(kafka_request->broker_addr, assumed_app_id);
|
|
|
-// bpf_printk("digit[%d]=%c", 0, assumed_app_id[0]);
|
|
|
+// cw_bpf_debug("digit[%d]=%c", 0, assumed_app_id[0]);
|
|
|
// return 0;
|
|
|
|
|
|
// set_assumed_app_id_arrays2(kafka_request->broker_addr, assumed_app_id);
|
|
|
/*临时map绕一下*/
|
|
|
// struct kafka_request_t2 *kafka_request2 = bpf_map_lookup_elem(&kafka_request_storage_map2, &actual_id);
|
|
|
// if (kafka_request2 == NULL) {
|
|
|
-// bpf_printk("uprobe/WriteMessages: Failed to get kafka_request");
|
|
|
+// cw_bpf_debug("uprobe/WriteMessages: Failed to get kafka_request");
|
|
|
// return 0;
|
|
|
// }
|
|
|
// __builtin_memset(kafka_request2, 0, sizeof(struct kafka_request_t2));
|
|
|
@@ -357,7 +357,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
|
|
|
|
|
|
|
|
|
- bpf_printk("Kafka BrokerAddr = %s", kafka_request->host);
|
|
|
+ cw_bpf_debug("Kafka BrokerAddr = %s", kafka_request->host);
|
|
|
struct apm_span_context *cw_psc = cw_get_parent_tracking_span();
|
|
|
|
|
|
if(cw_psc){
|
|
|
@@ -373,7 +373,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
bool global_topic = get_go_string_from_user_ptr((void *) (writer + proc_info->kafka_writer_topic_pos), kafka_request->global_topic,
|
|
|
sizeof(kafka_request->global_topic));
|
|
|
|
|
|
- bpf_printk("global_topic %d %s",global_topic,kafka_request->global_topic);
|
|
|
+ cw_bpf_debug("global_topic %d %s",global_topic,kafka_request->global_topic);
|
|
|
|
|
|
|
|
|
void *msg_ptr = msgs_array;
|
|
|
@@ -381,7 +381,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
u32 header_storage_id = 0;
|
|
|
struct kafka_header_t *header = bpf_map_lookup_elem(&kafka_header_storage_map, &header_storage_id);
|
|
|
if (header == NULL) {
|
|
|
- bpf_printk("uprobe/WriteMessages: Failed to get header storage");
|
|
|
+ cw_bpf_debug("uprobe/WriteMessages: Failed to get header storage");
|
|
|
return 0;
|
|
|
}
|
|
|
// Zero the header
|
|
|
@@ -420,7 +420,7 @@ int uprobe_WriteMessages(struct pt_regs *ctx) {
|
|
|
#ifndef NO_HEADER_PROPAGATION
|
|
|
// Build the header
|
|
|
if (build_contxet_header(header, &kafka_request->msgs[i].sc) != 0) {
|
|
|
- bpf_printk("uprobe/WriteMessages: Failed to build header");
|
|
|
+ cw_bpf_debug("uprobe/WriteMessages: Failed to build header");
|
|
|
return 0;
|
|
|
}
|
|
|
// Inject the header
|
|
|
@@ -445,7 +445,7 @@ int uprobe_WriteMessages_Returns(struct pt_regs *ctx) {
|
|
|
|
|
|
struct kafka_request_t *kafka_request = bpf_map_lookup_elem(&kafka_events, &key);
|
|
|
if (kafka_request == NULL) {
|
|
|
- bpf_printk("kafka_request is null\n");
|
|
|
+ cw_bpf_debug("kafka_request is null\n");
|
|
|
return 0;
|
|
|
}
|
|
|
kafka_request->end_time = bpf_ktime_get_ns();
|
|
|
@@ -488,8 +488,8 @@ int uprobe_WriteMessages_Returns(struct pt_regs *ctx) {
|
|
|
// bpf_probe_read(&e->payload, 22, kafka_request->host);
|
|
|
// bpf_probe_read(&e->payload , 50, kafka_request->msgs[i].topic);
|
|
|
|
|
|
-// bpf_printk("tttttttttttttt %s", kafka_request->msgs[i].topic);
|
|
|
-// bpf_printk("kkkkkkkkkk %s", kafka_request->msgs[i].key);
|
|
|
+// cw_bpf_debug("tttttttttttttt %s", kafka_request->msgs[i].topic);
|
|
|
+// cw_bpf_debug("kkkkkkkkkk %s", kafka_request->msgs[i].key);
|
|
|
|
|
|
// 填充 MQ 相关信息
|
|
|
bpf_probe_read(&e->mq.topic, sizeof(e->mq.topic), kafka_request->msgs[i].topic);
|
|
|
@@ -537,7 +537,7 @@ int uprobe_WriteMessages_Returns(struct pt_regs *ctx) {
|
|
|
|
|
|
// kafka_request->msgs[i].sc.span_id;
|
|
|
// for (int j = 0; j < 1; ++j) {
|
|
|
-// bpf_printk("valid_messages %02x",kafka_request->msgs[i].sc.span_id[j]);
|
|
|
+// cw_bpf_debug("valid_messages %02x",kafka_request->msgs[i].sc.span_id[j]);
|
|
|
// }
|
|
|
}
|
|
|
|