[chore] bump bun v1.1.14 -> v1.1.15 (#2195)

This commit is contained in:
tobi 2023-09-11 15:16:52 +02:00 committed by GitHub
commit 7011f57b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 273 additions and 90 deletions

View file

@ -2,7 +2,9 @@ package bunotel
import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
"go.opentelemetry.io/otel/trace"
)
type Option func(h *QueryHook)
@ -30,3 +32,23 @@ func WithFormattedQueries(format bool) Option {
h.formatQueries = format
}
}
// WithTracerProvider returns an Option to use the TracerProvider when
// creating a Tracer.
func WithTracerProvider(tp trace.TracerProvider) Option {
return func(h *QueryHook) {
if tp != nil {
h.tracer = tp.Tracer("github.com/uptrace/bun")
}
}
}
// WithMeterProvider returns an Option to use the MeterProvider when
// creating a Meter.
func WithMeterProvider(mp metric.MeterProvider) Option {
return func(h *QueryHook) {
if mp != nil {
h.meter = mp.Meter("github.com/uptrace/bun")
}
}
}