-
Notifications
You must be signed in to change notification settings - Fork 79
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
Instrument gRPC server span status codes #1127
base: main
Are you sure you want to change the base?
Conversation
637da87
to
0863a1e
Compare
internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/bpf/probe.bpf.c
Outdated
Show resolved
Hide resolved
internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/bpf/probe.bpf.c
Outdated
Show resolved
Hide resolved
internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/probe.go
Outdated
Show resolved
Hide resolved
d4212a2
to
d45da58
Compare
internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/bpf/probe.bpf.c
Outdated
Show resolved
Hide resolved
…/bpf/probe.bpf.c Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
02c614e
to
da38f26
Compare
Updated based on feedback and sig discussion, ptal! |
4ff185e
to
6676803
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added 2 small nits. looks great
void *key = get_consistent_key(ctx, go_context.data); | ||
|
||
struct grpc_request_t *grpcReq_event_ptr = bpf_map_lookup_elem(&grpc_events, &key); | ||
// if grpcReq_event is null, then handleStream probe didn't run. Try starting a new span here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if grpcReq_event is null, then handleStream probe didn't run. Try starting a new span here | |
// if we fail to get an active grpc span, nothing to do here |
bpf_probe_read_user(&s_ptr, sizeof(s_ptr), (void *)(status_ptr + status_s_pos)); | ||
// Get status code from Status.s pointer | ||
bpf_probe_read_user(&grpcReq_event_ptr->status_code, sizeof(grpcReq_event_ptr->status_code), (void *)(s_ptr + status_code_pos)); | ||
bpf_map_update_elem(&grpc_events, &key, grpcReq_event_ptr, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think this update call is redundant since we have a pointer to the map element and we are updating the underlying memory, but worth making sure.
Ref #172