Skip to content

Commit

Permalink
Don't include db.query if it is empty (#1246)
Browse files Browse the repository at this point in the history
* Don't include db.query if it is empty

* Add changelog entry
  • Loading branch information
RonFed authored Nov 6, 2024
1 parent 454a9ca commit 2b22ff5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http

## [Unreleased]

### Fixed

- Don't include `db.query.text` attribute in `database/sql` if the query string is empty or not collected. ([#1246](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1246))

## [v0.17.0-alpha] - 2024-11-05

### Changed
Expand Down
4 changes: 3 additions & 1 deletion internal/pkg/instrumentation/bpf/database/sql/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ func processFn(e *event) ptrace.SpanSlice {
}

query := unix.ByteSliceToString(e.Query[:])
span.Attributes().PutStr(string(semconv.DBQueryTextKey), query)
if query != "" {
span.Attributes().PutStr(string(semconv.DBQueryTextKey), query)
}

return spans
}
Expand Down

0 comments on commit 2b22ff5

Please sign in to comment.