24 lines
893 B
Go
24 lines
893 B
Go
package postgres
|
|
|
|
import (
|
|
pgshared "galaxy/postgres"
|
|
|
|
metricnoop "go.opentelemetry.io/otel/metric/noop"
|
|
tracenoop "go.opentelemetry.io/otel/trace/noop"
|
|
)
|
|
|
|
// NoObservabilityOptions returns the pgshared options that pin a fresh
|
|
// `*sql.DB` to no-op tracer and meter providers. Tests that bring up a
|
|
// real Postgres testcontainer use it so the otelsql instrumentation
|
|
// never falls back to the global tracer/meter — leaving an OTLP
|
|
// endpoint accidentally configured in the developer environment cannot
|
|
// stall the test on a background exporter handshake. Production code
|
|
// passes the runtime's real providers through galaxy/postgres directly
|
|
// and does not touch this helper.
|
|
func NoObservabilityOptions() []pgshared.Option {
|
|
return []pgshared.Option{
|
|
pgshared.WithTracerProvider(tracenoop.NewTracerProvider()),
|
|
pgshared.WithMeterProvider(metricnoop.NewMeterProvider()),
|
|
}
|
|
}
|