Skip to content

Commit

Permalink
fix(otelglobal): use correct SetName arg offsets and simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asecondo authored and Tony Secondo committed Jan 11, 2024
1 parent 7cc2452 commit 3c8c55f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ int uprobe_SetName(struct pt_regs *ctx) {
return 0;
}

void *span_name_ptr = get_argument(ctx, 4);
void *span_name_ptr = get_argument(ctx, 2);
if (span_name_ptr == NULL) {
return 0;
}

void *span_name_len_ptr = get_argument(ctx, 5);
void *span_name_len_ptr = get_argument(ctx, 3);
if (span_name_len_ptr == NULL) {
return 0;
}
Expand Down
9 changes: 1 addition & 8 deletions internal/test/e2e/otelglobal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,14 @@ func innerFunction(ctx context.Context) {
defer span.End()

span.SetAttributes(attribute.String("inner.key", "inner.value"))
}

func setNameOverride(ctx context.Context) {
_, span := tracer.Start(ctx, "SetNameOriginal")
defer span.End()

span.SetName("SetNameOverride")
span.SetName("child override")
}

func createMainSpan(ctx context.Context) {
ctx, span := tracer.Start(ctx, "parent")
defer span.End()

innerFunction(ctx)
setNameOverride(ctx)

intAttr := attribute.Int("int_key", 42)
strAttr := attribute.String("string_key", "forty-two")
Expand Down
11 changes: 1 addition & 10 deletions internal/test/e2e/otelglobal/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,7 @@
}
],
"kind": 3,
"name": "child",
"parentSpanId": "xxxxx",
"spanId": "xxxxx",
"status": {},
"traceId": "xxxxx"
},
{
"attributes": [],
"kind": 3,
"name": "SetNameOverride",
"name": "child override",
"parentSpanId": "xxxxx",
"spanId": "xxxxx",
"status": {},
Expand Down

0 comments on commit 3c8c55f

Please sign in to comment.