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

Instrument gRPC server span status codes #1127

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

damemi
Copy link
Contributor

@damemi damemi commented Sep 25, 2024

Ref #172

@damemi damemi requested a review from a team as a code owner September 25, 2024 14:37
@damemi damemi force-pushed the grpc-server-status-code branch 2 times, most recently from 637da87 to 0863a1e Compare September 25, 2024 14:43
@damemi damemi force-pushed the grpc-server-status-code branch 3 times, most recently from d4212a2 to d45da58 Compare October 15, 2024 15:56
@damemi
Copy link
Contributor Author

damemi commented Oct 24, 2024

Updated based on feedback and sig discussion, ptal!

Copy link
Contributor

@RonFed RonFed left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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);
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants