Skip to content

Commit

Permalink
refactor: rename read_span_name and reorder params
Browse files Browse the repository at this point in the history
  • Loading branch information
asecondo committed Jan 13, 2024
1 parent 5451741 commit 895bd6c
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ struct {
// Injected in init
volatile const u64 tracer_delegate_pos;


// span_name_read reads the span name from the provided span_name_ptr and stores the result in
// read_span_name reads the span name from the provided span_name_ptr and stores the result in
// span_name.buf.
static __always_inline void span_name_read(void *span_name_ptr, struct span_name_t *span_name, const u64 span_name_len) {
static __always_inline void read_span_name(struct span_name_t *span_name, const u64 span_name_len, void *span_name_ptr) {
const u64 span_name_size = MAX_SPAN_NAME_LEN < span_name_len ? MAX_SPAN_NAME_LEN : span_name_len;
bpf_probe_read(span_name->buf, span_name_size, span_name_ptr);
}
Expand All @@ -89,7 +88,7 @@ int uprobe_Start(struct pt_regs *ctx) {
// Getting span name
void *span_name_ptr = get_argument(ctx, 4);
u64 span_name_len = (u64)get_argument(ctx, 5);
span_name_read(span_name_ptr, &span_name, span_name_len);
read_span_name(&span_name, span_name_len, span_name_ptr);

// Save the span name in map to be read once the Start function returns
void *context_ptr_val = get_Go_context(ctx, 3, 0, true);
Expand Down Expand Up @@ -192,7 +191,7 @@ int uprobe_SetName(struct pt_regs *ctx) {
u64 span_name_len = (u64)span_name_len_ptr;
struct span_name_t span_name = {0};

span_name_read(span_name_ptr, &span_name, span_name_len);
read_span_name(&span_name, span_name_len, span_name_ptr);
span->span_name = span_name;
bpf_map_update_elem(&active_spans_by_span_ptr, &non_recording_span_ptr, span, 0);

Expand Down

0 comments on commit 895bd6c

Please sign in to comment.