diff --git a/sql_tracing.go b/sql_tracing.go index ba54209..e1c4df9 100644 --- a/sql_tracing.go +++ b/sql_tracing.go @@ -26,7 +26,7 @@ type dbCtxVal struct { attrs []attribute.KeyValue } -type tracedPgxHooks struct { +type tracedSQLHooks struct { dbType string t *Telemetry @@ -36,7 +36,7 @@ type tracedPgxHooks struct { mDuration metric.Float64Histogram } -func (h *tracedPgxHooks) Before(ctx context.Context, query string, args ...interface{}) (context.Context, error) { +func (h *tracedSQLHooks) Before(ctx context.Context, query string, args ...interface{}) (context.Context, error) { cleanedQuery := strings.ReplaceAll(query, "\n", " ") cleanedQuery = strings.ReplaceAll(cleanedQuery, "\t", " ") cleanedQuery = strings.ReplaceAll(cleanedQuery, " ", " ") @@ -78,7 +78,7 @@ func (h *tracedPgxHooks) Before(ctx context.Context, query string, args ...inter }), nil } -func (h *tracedPgxHooks) After(ctx context.Context, query string, args ...interface{}) (context.Context, error) { +func (h *tracedSQLHooks) After(ctx context.Context, query string, args ...interface{}) (context.Context, error) { if s := SpanFromContext(ctx); s != nil { s.End() } @@ -106,7 +106,7 @@ func (t *Telemetry) TraceSQL(driver driver.Driver, dbType string, printQueries b log.Fatal().Err(err).Msg("failed to create request duration histogram") } - return sqlhooks.Wrap(driver, &tracedPgxHooks{ + return sqlhooks.Wrap(driver, &tracedSQLHooks{ dbType: dbType, printQueries: printQueries,