From 8fbc129bf11494d6789ecb36dcfb8828a6311aa3 Mon Sep 17 00:00:00 2001 From: wakamenod Date: Sun, 9 Oct 2022 21:45:57 +0900 Subject: [PATCH] Add query args to instrumentation --- 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) {}