Skip to content

Commit

Permalink
Add query args to instrumentation (#314)
Browse files Browse the repository at this point in the history
Co-authored-by: Surya Asriadie <surya.asriadie@gmail.com>
  • Loading branch information
wakamenod and Fs02 committed Oct 15, 2022
1 parent 001ce33 commit eaad046
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions instrumentation.go
Expand Up @@ -9,19 +9,19 @@ import (

// Instrumenter defines function type that can be used for instrumetation.
// This function should return a function with no argument as a callback for finished execution.
type Instrumenter func(ctx context.Context, op string, message string) func(err error)
type Instrumenter func(ctx context.Context, op string, message string, args ...any) func(err error)

// Observe operation.
func (i Instrumenter) Observe(ctx context.Context, op string, message string) func(err error) {
func (i Instrumenter) Observe(ctx context.Context, op string, message string, args ...any) func(err error) {
if i != nil {
return i(ctx, op, message)
return i(ctx, op, message, args)
}

return func(err error) {}
}

// DefaultLogger instrumentation to log queries and rel operation.
func DefaultLogger(ctx context.Context, op string, message string) func(err error) {
func DefaultLogger(ctx context.Context, op string, message string, args ...any) func(err error) {
// no op for rel functions.
if strings.HasPrefix(op, "rel-") {
return func(error) {}
Expand Down

0 comments on commit eaad046

Please sign in to comment.