Documentation
¶
Overview ¶
Code generated by internal/generate/capabilities.py; DO NOT EDIT.
Code generated by internal/generate/capabilities.py; DO NOT EDIT.
Code generated by internal/generate/capabilities.py; DO NOT EDIT.
Package firebirdotel provides OpenTelemetry instrumentation helpers for the github.com/nakagami/firebirdsql database/sql driver.
Index ¶
- Constants
- Variables
- func AttributesFromDSN(dsn string) []attribute.KeyValue
- func DefaultAttributes(dsn string) []attribute.KeyValue
- func ErrorAttributes(err error) []attribute.KeyValue
- func Instrument() (string, error)
- 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 OpenDBWithConfig(connector driver.Connector, c Config) (*sql.DB, error)
- func OpenDBWithDSN(connector driver.Connector, dsn string, options ...Option) *sql.DB
- func OpenWithConfig(dsn string, c Config) (*sql.DB, error)
- func OpenWithDriver(driverName, dsn string, options ...Option) (*sql.DB, error)
- func OpenWithDriverConfig(d driver.Driver, dsn string, c Config) (*sql.DB, error)
- func Raw(conn *sql.Conn, fn func(any) error) 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 RegisterDBStatsMetricsWithConfig(db *sql.DB, c Config) (metric.Registration, error)
- func RegisterWithConfig(c Config) (string, error)
- func RegisterWithDriver(driverName, dsn string, options ...Option) (string, error)
- func WithOperationHint(ctx context.Context, h OperationHint) context.Context
- func WrapConnector(connector driver.Connector, c Config) (driver.Connector, error)
- type AttributesGetter
- type ClientDiagnosticsConfig
- type Config
- type ConnectionAttributes
- type InstrumentAttributesGetter
- type InstrumentErrorAttributesGetter
- type Method
- type Operation
- type OperationHint
- 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 Profile
- type ProfilerConfig
- type RowsColumnTypeDatabaseTypeNameMethods
- type RowsColumnTypeLengthMethods
- type RowsColumnTypeNullableMethods
- type RowsColumnTypePrecisionScaleMethods
- type RowsColumnTypeScanTypeMethods
- type RowsNextResultSetMethods
- type SQLMode
- type SQLPolicy
- type ServerTrace
- 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 ¶
var ErrInstrumentation = errors.New("firebirdotel: instrumentation failure")
ErrInstrumentation identifies a failure to initialize telemetry, not a database error.
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 ErrorAttributes ¶ added in v0.1.2
ErrorAttributes returns bounded codes, never err.Error(), Message, Params or wrapped messages.
func Instrument ¶ added in v0.1.2
Instrument enables safe Firebird query spans and operation duration metrics using the application's global OpenTelemetry providers. Pass the returned driver name to the existing sql.Open or framework setup. Call once at startup and reuse the name; the application still owns connections and pool settings. For optional telemetry overrides, use RegisterWithConfig.
func OpenCreateDB ¶
OpenCreateDB opens an instrumented Firebird create-database handle.
func OpenDBWithConfig ¶ added in v0.1.2
OpenDBWithConfig takes an uninstrumented, client-dialect-3 connector. Call Raw to access native connections.
func OpenDBWithDSN ¶
OpenDBWithDSN wraps a driver connector and also derives network attributes from dsn.
func OpenWithConfig ¶ added in v0.1.2
OpenWithConfig opts into safe instrumentation. The zero Config is safe_client. SQL descriptions use client dialect 3, as does the pinned Firebird driver.
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 OpenWithDriverConfig ¶ added in v0.1.2
OpenWithDriverConfig accepts an explicit driver using client dialect 3. DriverContext factories run exactly once; named compatibility APIs are unchanged.
func Raw ¶ added in v0.1.2
Raw calls fn with the underlying connection only while database/sql holds it. The connection must not be retained after fn returns; the same contract as sql.Conn.Raw applies.
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.
func RegisterDBStatsMetricsWithConfig ¶ added in v0.1.2
RegisterDBStatsMetricsWithConfig registers pool statistics using metric dimensions only. Keep the registration and call Unregister before closing the providers.
func RegisterWithConfig ¶ added in v0.1.2
RegisterWithConfig registers instrumented Firebird and returns a driver name for the application's existing sql.Open or framework configuration. It does not connect to Firebird, configure a pool, or register pool statistics. The zero Config enables safe tracing and operation metrics with global providers. Register once at startup per telemetry configuration and reuse the name: database/sql registrations last for the lifetime of the process. Use Register for the legacy compatibility profile.
func RegisterWithDriver ¶
RegisterWithDriver registers an instrumented wrapper around driverName.
func WithOperationHint ¶ added in v0.1.2
func WithOperationHint(ctx context.Context, h OperationHint) context.Context
WithOperationHint adds a trusted object name, never SQL or argument values. Invalid identifiers are ignored. The executed SQL is unchanged.
Types ¶
type AttributesGetter ¶
type AttributesGetter = otelsql.AttributesGetter
AttributesGetter returns span attributes for a database/sql operation.
type ClientDiagnosticsConfig ¶ added in v0.1.2
type Config ¶ added in v0.1.2
type Config struct {
// ServerTrace optionally associates sampled operations with a separately started
// server collector. It adds a reserved session marker query before execution.
ServerTrace ServerTrace
Profiler ProfilerConfig
Profile Profile
SQL SQLPolicy
Connection ConnectionAttributes
Client ClientDiagnosticsConfig
TracerProvider trace.TracerProvider
MeterProvider metric.MeterProvider
// SpanAttributes are never copied to metric dimensions. Caller-supplied attributes are trusted.
SpanAttributes []attribute.KeyValue
// MetricAttributes must be a bounded, low-cardinality vocabulary chosen by the application.
MetricAttributes []attribute.KeyValue
// OTelOptions are accepted only by Compatibility. Safe modes reject opaque callbacks/options.
OTelOptions []Option
}
func CompatibilityConfig ¶ added in v0.1.2
CompatibilityConfig retains the original otelsql behavior, including its SQL/error policy.
func DiagnosticConfig ¶ added in v0.1.2
func DiagnosticConfig() Config
func SafeConfig ¶ added in v0.1.2
func SafeConfig() Config
type ConnectionAttributes ¶ added in v0.1.2
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 OperationHint ¶ added in v0.1.2
type OperationHint struct{ Procedure string }
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 ProfilerConfig ¶ added in v0.3.0
type ProfilerConfig struct {
Enabled bool
Starter fbprofiler.Starter
}
ProfilerConfig keeps Firebird Profiler opt-in even when a Starter is supplied. Profiling follows the application's existing trace sampling decision.
type RowsColumnTypeDatabaseTypeNameMethods ¶ added in v0.1.2
type RowsColumnTypeLengthMethods ¶ added in v0.1.2
type RowsColumnTypeNullableMethods ¶ added in v0.1.2
type RowsColumnTypePrecisionScaleMethods ¶ added in v0.1.2
type RowsColumnTypeScanTypeMethods ¶ added in v0.1.2
type RowsNextResultSetMethods ¶ added in v0.1.2
type ServerTrace ¶ added in v0.1.2
type ServerTrace interface {
Register(trace.SpanContext) string
Bind(string, trace.SpanContext)
Discard(string)
}
type SpanNameFormatter ¶
type SpanNameFormatter = otelsql.SpanNameFormatter
SpanNameFormatter formats span names.
type SpanOptions ¶
type SpanOptions = otelsql.SpanOptions
SpanOptions controls which database/sql operations create spans.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic
command
|
|
|
benchmark
command
Run only against testdata/firebird5.
|
Run only against testdata/firebird5. |
|
profiler
command
A manual Firebird 5 profiling scope.
|
A manual Firebird 5 profiling scope. |
|
safe
command
|
|
|
internal
|
|
|
otelsqlfirebird
Package otelsqlfirebird is a regression fixture for coincidental package names.
|
Package otelsqlfirebird is a regression fixture for coincidental package names. |
|
sqltext
Package sqltext implements bounded, fail-closed Firebird SQL descriptions.
|
Package sqltext implements bounded, fail-closed Firebird SQL descriptions. |
|
traceparse
Package traceparse parses a bounded subset of Firebird 5 text Trace.
|
Package traceparse parses a bounded subset of Firebird 5 text Trace. |
|
Package metadata reads possible schema dependencies.
|
Package metadata reads possible schema dependencies. |
|
Package monitoring reads one scoped MON$ snapshot per owned transaction.
|
Package monitoring reads one scoped MON$ snapshot per owned transaction. |
|
Package profiler collects Firebird 5 record-source measurements for sampled SQL operations.
|
Package profiler collects Firebird 5 record-source measurements for sampled SQL operations. |
|
Package trace provides an experimental in-process Firebird Trace collector.
|
Package trace provides an experimental in-process Firebird Trace collector. |