Documentation
¶
Overview ¶
Package firebirdotel provides OpenTelemetry instrumentation helpers for the github.com/nakagami/firebirdsql database/sql driver.
Index ¶
- Constants
- func AttributesFromDSN(dsn string) []attribute.KeyValue
- func DefaultAttributes(dsn string) []attribute.KeyValue
- func Open(dsn string, options ...Option) (*sql.DB, error)
- func OpenCreateDB(dsn string, options ...Option) (*sql.DB, error)
- func OpenDB(connector driver.Connector, options ...Option) *sql.DB
- func OpenDBWithDSN(connector driver.Connector, dsn string, options ...Option) *sql.DB
- func OpenWithDriver(driverName, dsn string, options ...Option) (*sql.DB, error)
- func Register(options ...Option) (string, error)
- func RegisterCreateDB(options ...Option) (string, error)
- func RegisterDBStatsMetrics(db *sql.DB, dsn string, options ...Option) (metric.Registration, error)
- func RegisterWithDriver(driverName, dsn string, options ...Option) (string, error)
- type AttributesGetter
- type InstrumentAttributesGetter
- type InstrumentErrorAttributesGetter
- type Method
- type Option
- func WithAttributes(attributes ...attribute.KeyValue) Option
- func WithAttributesGetter(getter AttributesGetter) Option
- func WithDefaultAttributes(dsn string) Option
- func WithInstrumentAttributesGetter(getter InstrumentAttributesGetter) Option
- func WithInstrumentErrorAttributesGetter(getter InstrumentErrorAttributesGetter) Option
- func WithMeterProvider(provider metric.MeterProvider) Option
- func WithSQLCommenter(enabled bool) Option
- func WithSpanNameFormatter(formatter SpanNameFormatter) Option
- func WithSpanOptions(options SpanOptions) Option
- func WithTracerProvider(provider trace.TracerProvider) Option
- type SpanNameFormatter
- type SpanOptions
Constants ¶
const ( // DriverName is the standard driver name registered by github.com/nakagami/firebirdsql. DriverName = "firebirdsql" // CreateDBDriverName is the create-database driver name registered by github.com/nakagami/firebirdsql. CreateDBDriverName = "firebirdsql_createdb" )
Variables ¶
This section is empty.
Functions ¶
func AttributesFromDSN ¶
AttributesFromDSN returns best-effort network attributes parsed from dsn.
func DefaultAttributes ¶
DefaultAttributes returns Firebird database semantic attributes plus best-effort network attributes parsed from dsn.
func OpenCreateDB ¶
OpenCreateDB opens an instrumented Firebird create-database handle.
func OpenDBWithDSN ¶
OpenDBWithDSN wraps a driver connector and also derives network attributes from dsn.
func OpenWithDriver ¶
OpenWithDriver opens an instrumented database handle using a registered driver.
This is useful for tests and for applications that register a custom Firebird driver name.
func Register ¶
Register registers an instrumented wrapper around the Firebird driver and returns the generated driver name.
Prefer Open when each sql.DB handle has a known DSN. Register is useful for frameworks that need a driver name before calling sql.Open themselves.
func RegisterCreateDB ¶
RegisterCreateDB registers an instrumented wrapper around the create-database driver.
func RegisterDBStatsMetrics ¶
RegisterDBStatsMetrics registers database/sql pool statistics metrics for db.
Types ¶
type AttributesGetter ¶
type AttributesGetter = otelsql.AttributesGetter
AttributesGetter returns span attributes for a database/sql operation.
type InstrumentAttributesGetter ¶
type InstrumentAttributesGetter = otelsql.InstrumentAttributesGetter
InstrumentAttributesGetter returns metric attributes for a successful operation.
type InstrumentErrorAttributesGetter ¶
type InstrumentErrorAttributesGetter = otelsql.InstrumentErrorAttributesGetter
InstrumentErrorAttributesGetter returns metric attributes for a failed operation.
type Option ¶
Option configures OpenTelemetry behavior.
func WithAttributes ¶
WithAttributes adds static attributes to spans and metrics.
func WithAttributesGetter ¶
func WithAttributesGetter(getter AttributesGetter) Option
WithAttributesGetter configures per-operation span attributes.
func WithDefaultAttributes ¶
WithDefaultAttributes adds Firebird database semantic attributes and best-effort network attributes parsed from dsn.
func WithInstrumentAttributesGetter ¶
func WithInstrumentAttributesGetter(getter InstrumentAttributesGetter) Option
WithInstrumentAttributesGetter configures per-operation metric attributes.
func WithInstrumentErrorAttributesGetter ¶
func WithInstrumentErrorAttributesGetter(getter InstrumentErrorAttributesGetter) Option
WithInstrumentErrorAttributesGetter configures per-operation metric error attributes.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider) Option
WithMeterProvider configures the meter provider used by metrics.
func WithSQLCommenter ¶
WithSQLCommenter enables SQLCommenter trace context injection.
func WithSpanNameFormatter ¶
func WithSpanNameFormatter(formatter SpanNameFormatter) Option
WithSpanNameFormatter configures span names.
func WithSpanOptions ¶
func WithSpanOptions(options SpanOptions) Option
WithSpanOptions configures which database/sql operations create spans.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider configures the tracer provider used by spans.
type SpanNameFormatter ¶
type SpanNameFormatter = otelsql.SpanNameFormatter
SpanNameFormatter formats span names.
type SpanOptions ¶
type SpanOptions = otelsql.SpanOptions
SpanOptions controls which database/sql operations create spans.