Documentation ¶
Index ¶
- func Open(driverName, dsn string, opts ...Option) (*sql.DB, error)
- func OpenDB(connector driver.Connector, opts ...Option) *sql.DB
- func ReportDBStatsMetrics(db *sql.DB, opts ...Option)
- func Version() string
- type Option
- func WithAttributes(attrs ...attribute.KeyValue) Option
- func WithDBName(name string) Option
- func WithDBSystem(system string) Option
- func WithMeterProvider(meterProvider metric.MeterProvider) Option
- func WithQueryFormatter(queryFormatter func(query string) string) Option
- func WithTracerProvider(tracerProvider trace.TracerProvider) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open is a wrapper over sql.Open that instruments the sql.DB to record executed queries using OpenTelemetry API.
func OpenDB ¶
OpenDB is a wrapper over sql.OpenDB that instruments the sql.DB to record executed queries using OpenTelemetry API.
func ReportDBStatsMetrics ¶
ReportDBStatsMetrics reports DBStats metrics using OpenTelemetry Metrics API.
Types ¶
type Option ¶
type Option func(c *config)
func WithAttributes ¶
WithAttributes configures attributes that are used to create a span.
func WithDBSystem ¶
WithDBSystem configures a db.system attribute. You should prefer using WithAttributes and semconv, for example, `otelsql.WithAttributes(semconv.DBSystemSqlite)`.
func WithMeterProvider ¶
func WithMeterProvider(meterProvider metric.MeterProvider) Option
WithMeterProvider configures a metric.Meter used to create instruments.
func WithQueryFormatter ¶
WithQueryFormatter configures a query formatter
func WithTracerProvider ¶
func WithTracerProvider(tracerProvider trace.TracerProvider) Option
WithTracerProvider configures a tracer provider that is used to create a tracer.