From 1c18231f3369751e437fa30463ffae69774babbb Mon Sep 17 00:00:00 2001 From: Bastian Winkler Date: Mon, 12 May 2025 08:03:59 +0200 Subject: [PATCH] chore: use custom context key type Use a custom context key type to prevent key collisions. --- tracer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tracer.go b/tracer.go index b9c3b07..516fb22 100644 --- a/tracer.go +++ b/tracer.go @@ -21,10 +21,12 @@ import ( "go.opentelemetry.io/otel/trace" ) +type contextKey int8 + const ( tracerName = "github.com/exaring/otelpgx" meterName = "github.com/exaring/otelpgx" - startTimeCtxKey = "otelpgxStartTime" + startTimeCtxKey = contextKey(0) sqlOperationUnknown = "UNKNOWN" )