Skip to content

Commit

Permalink
Add query args to instrumentation (#40)
Browse files Browse the repository at this point in the history
* Add query args to instrumentation

* use latest rel@master
  • Loading branch information
wakamenod authored Oct 17, 2022
1 parent ac6e8b8 commit d90b115
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/go-rel/sql
go 1.15

require (
github.com/go-rel/rel v0.38.0
github.com/go-rel/rel v0.38.1-0.20221015045639-eaad046afb92
github.com/stretchr/testify v1.8.0
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-rel/rel v0.38.0 h1:XooFDMrzHNaZSNvH1ZrEpcn/7TvPz37z1kA66N3Ahjo=
github.com/go-rel/rel v0.38.0/go.mod h1:Zq18pQqXZbDh2JBCo29jgt+y90nZWkUvI+W9Ls29ans=
github.com/go-rel/rel v0.38.1-0.20221015045639-eaad046afb92 h1:TRoaCjWpJMQG4DxUMrpb3yru+uTteIqM4c2yMiWfvlM=
github.com/go-rel/rel v0.38.1-0.20221015045639-eaad046afb92/go.mod h1:ltZrjCVAkNq4zu/TGvC1MhlgnMmB8hrzr0tiDbBUeJM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
Expand Down Expand Up @@ -39,9 +41,11 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo=
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
4 changes: 2 additions & 2 deletions sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s SQL) DoExec(ctx context.Context, statement string, args []any) (sql.Resu
var (
err error
result sql.Result
finish = s.Instrumenter.Observe(ctx, "adapter-exec", statement)
finish = s.Instrumenter.Observe(ctx, "adapter-exec", statement, args...)
)

if s.Tx != nil {
Expand All @@ -63,7 +63,7 @@ func (s SQL) DoQuery(ctx context.Context, statement string, args []any) (*sql.Ro
rows *sql.Rows
)

finish := s.Instrumenter.Observe(ctx, "adapter-query", statement)
finish := s.Instrumenter.Observe(ctx, "adapter-query", statement, args...)
if s.Tx != nil {
rows, err = s.Tx.QueryContext(ctx, statement, args...)
} else {
Expand Down

0 comments on commit d90b115

Please sign in to comment.