Skip to content

Commit

Permalink
feat(bunotel): always record affected rows
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Feb 9, 2025
1 parent e8c87a9 commit 960a304
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions extra/bunotel/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
attrs = append(attrs, sys)
}
if event.Result != nil {
if n, _ := event.Result.RowsAffected(); n > 0 {
attrs = append(attrs, attribute.Int64("db.rows_affected", n))
}
rows, _ := event.Result.RowsAffected()
attrs = append(attrs, attribute.Int64("db.rows_affected", rows))
}

switch event.Err {
Expand Down

0 comments on commit 960a304

Please sign in to comment.