From f1dabe82c8eb1c2447522320fd79aad59398e0a0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 7 Feb 2025 12:15:51 -0800 Subject: [PATCH] Fix database instrumentation for Go < 1.17 (#1772) * Fix database instrumentation for Go < 1.17 Use the correct context argument position in the UPROBE_RETURN macro. * Add a changelog entry --- CHANGELOG.md | 4 ++++ internal/pkg/instrumentation/bpf/database/sql/bpf/probe.bpf.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c2af362..3638ab266 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http - Support Go `1.22.12`. ([#1743](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1743)) - Support Go `1.23.6`. ([#1743](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1743)) +### Fixed + +- `database/sql` instrumentation for Go < `1.17`. (#1772) + ## [v0.20.0] - 2025-01-29 ### Added diff --git a/internal/pkg/instrumentation/bpf/database/sql/bpf/probe.bpf.c b/internal/pkg/instrumentation/bpf/database/sql/bpf/probe.bpf.c index 9ef6086d6..a814e1d4f 100644 --- a/internal/pkg/instrumentation/bpf/database/sql/bpf/probe.bpf.c +++ b/internal/pkg/instrumentation/bpf/database/sql/bpf/probe.bpf.c @@ -69,7 +69,7 @@ int uprobe_queryDC(struct pt_regs *ctx) { // This instrumentation attaches uprobe to the following function: // func (db *DB) queryDC(ctx, txctx context.Context, dc *driverConn, releaseConn func(error), query string, args []any) -UPROBE_RETURN(queryDC, struct sql_request_t, sql_events, events, 3, 0, true) +UPROBE_RETURN(queryDC, struct sql_request_t, sql_events, events, 2, 0, true) // This instrumentation attaches uprobe to the following function: // func (db *DB) execDC(ctx context.Context, dc *driverConn, release func(error), query string, args []any)