|
|
@@ -90,6 +90,12 @@ volatile const bool write_status_supported;
|
|
|
// func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error
|
|
|
SEC("uprobe/ClientConn_Invoke")
|
|
|
int uprobe_ClientConn_Invoke(struct pt_regs *ctx) {
|
|
|
+ struct apm_trace_key_t trace_key = get_apm_trace_key(120 * NS_PER_SEC, true);
|
|
|
+// bpf_printk("get1 %d",trace_key.goid);
|
|
|
+// void *key1 = (void *)GOROUTINE(ctx);
|
|
|
+// bpf_printk("key1 %llu",key1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
// bpf_printk("enter the uprobe_ClientConn_Invoke \n");
|
|
|
// positions
|
|
|
u64 clientconn_pos = 1;
|
|
|
@@ -160,6 +166,8 @@ int uprobe_ClientConn_Invoke(struct pt_regs *ctx) {
|
|
|
// func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error
|
|
|
SEC("uprobe/ClientConn_Invoke")
|
|
|
int uprobe_ClientConn_Invoke_Returns(struct pt_regs *ctx) {
|
|
|
+ return 0;
|
|
|
+
|
|
|
// bpf_printk("enter the uprobe_ClientConn_Invoke_Returns \n");
|
|
|
void *key = (void *)GOROUTINE(ctx);
|
|
|
struct grpc_client_request_t *grpc_span = bpf_map_lookup_elem(&grpc_client_events, &key);
|
|
|
@@ -293,6 +301,21 @@ cw_append_item_to_slice(void *new_item, u32 item_size, void *slice_user_ptr) {
|
|
|
|
|
|
SEC("uprobe/loopyWriter_headerHandler")
|
|
|
int uprobe_LoopyWriter_HeaderHandler(struct pt_regs *ctx) {
|
|
|
+// struct apm_trace_key_t trace_key = get_apm_trace_key(120 * NS_PER_SEC, true);
|
|
|
+// bpf_printk("get2 %d",trace_key.goid);
|
|
|
+
|
|
|
+// void *key1 = (void *)GOROUTINE(ctx);
|
|
|
+// bpf_printk("LoopyWriter_HeaderHandler %llu",key1);
|
|
|
+
|
|
|
+ void *headerFrame_ptr2 = get_argument(ctx, 2);
|
|
|
+ u32 stream_id = 0;
|
|
|
+ bpf_probe_read(
|
|
|
+ &stream_id, sizeof(stream_id), (void *)(headerFrame_ptr2 + (headerFrame_streamid_pos)));
|
|
|
+ bpf_printk("LoopyWriter_HeaderHandler stream_id -> %d",stream_id);
|
|
|
+
|
|
|
+// cw_get_parent_tracking_span();
|
|
|
+ return 0;
|
|
|
+
|
|
|
void *headerFrame_ptr = get_argument(ctx, 2);
|
|
|
bpf_printk("enter the get header handler storage\n");
|
|
|
|
|
|
@@ -399,19 +422,22 @@ int uprobe_LoopyWriter_HeaderHandler(struct pt_regs *ctx) {
|
|
|
SEC("uprobe/http2Client_NewStream")
|
|
|
// func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error)
|
|
|
int uprobe_http2Client_NewStream(struct pt_regs *ctx) {
|
|
|
- // bpf_printk("enter the uprobe_http2Client_NewStream \n");
|
|
|
- // struct go_iface go_context = {0};
|
|
|
- // get_Go_context(ctx, 2, 0, true);
|
|
|
- // void *httpclient_ptr = get_argument(ctx, 1);
|
|
|
- // u32 nextid = 0;
|
|
|
- // bpf_probe_read(&nextid, sizeof(nextid), (void *)(httpclient_ptr + (httpclient_nextid_pos)));
|
|
|
- // // Get the span context from go context. The mapping is created in the Invoke probe,
|
|
|
- // // the context here is derived from the Invoke context.
|
|
|
- // struct span_context *current_span_context = get_parent_span_context(&go_context);
|
|
|
- // if (current_span_context != NULL) {
|
|
|
- // bpf_printk("uprobe_http2Client_NewStream streamid is %d\n", nextid);
|
|
|
- // bpf_map_update_elem(&streamid_to_span_contexts, &nextid, current_span_context, 0);
|
|
|
- // }
|
|
|
+ struct apm_trace_key_t trace_key = get_apm_trace_key(120 * NS_PER_SEC, true);
|
|
|
+// bpf_printk("http2Client_NewStream goid %d",trace_key.goid);
|
|
|
+ struct go_iface go_context = {0};
|
|
|
+ get_Go_context2(ctx, 2, 0, true, &go_context);
|
|
|
+ void *httpclient_ptr = get_argument(ctx, 1);
|
|
|
+ u32 nextid = 0;
|
|
|
+ bpf_probe_read(&nextid, sizeof(nextid), (void *)(httpclient_ptr + (httpclient_nextid_pos)));
|
|
|
+ // Get the span context from go context. The mapping is created in the Invoke probe,
|
|
|
+ // the context here is derived from the Invoke context.
|
|
|
+ bpf_printk("http2Client_NewStream goid:%d -> stream_id:%d",trace_key.goid,nextid);
|
|
|
+
|
|
|
+ struct span_context *current_span_context = get_parent_span_context(&go_context);
|
|
|
+ if (current_span_context != NULL) {
|
|
|
+ bpf_map_update_elem(&streamid_to_span_contexts, &nextid, current_span_context, 0);
|
|
|
+ bpf_printk("http2Client_NewStream nextid %d",nextid);
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
+ return 0;
|
|
|
}
|