From eaad046afb92d6f2f2d5eb436d775a5bba5d8eeb Mon Sep 17 00:00:00 2001 From: wakamenod <58534736+wakamenod@users.noreply.github.com> Date: Sat, 15 Oct 2022 13:56:39 +0900 Subject: [PATCH] Add query args to instrumentation (#314) Co-authored-by: Surya Asriadie --- instrumentation.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instrumentation.go b/instrumentation.go index 434de14e..90b1a684 100644 --- a/instrumentation.go +++ b/instrumentation.go @@ -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) {}