summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/extra/bunotel/option.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/extra/bunotel/option.go')
-rw-r--r--vendor/github.com/uptrace/bun/extra/bunotel/option.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/extra/bunotel/option.go b/vendor/github.com/uptrace/bun/extra/bunotel/option.go
index 4c9c90a30..4824f3863 100644
--- a/vendor/github.com/uptrace/bun/extra/bunotel/option.go
+++ b/vendor/github.com/uptrace/bun/extra/bunotel/option.go
@@ -1,6 +1,7 @@
package bunotel
import (
+ "github.com/uptrace/bun"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
@@ -33,6 +34,14 @@ func WithFormattedQueries(format bool) Option {
}
}
+// WithSpanNameFormatter takes a function that determines the span name
+// for a given query event.
+func WithSpanNameFormatter(f func(*bun.QueryEvent) string) Option {
+ return func(h *QueryHook) {
+ h.spanNameFormatter = f
+ }
+}
+
// WithTracerProvider returns an Option to use the TracerProvider when
// creating a Tracer.
func WithTracerProvider(tp trace.TracerProvider) Option {