Documentation
¶
Index ¶
- Constants
- func ContextWithTable(ctx context.Context, table string) context.Context
- func Enabled(config config.Config) bool
- func WrapBuilder(inner contractsdb.Builder, inst *Instrument) contractsdb.Builder
- func WrapTxBuilder(inner contractsdb.TxBuilder, inst *Instrument) contractsdb.TxBuilder
- type GormPlugin
- type Instrument
Constants ¶
View Source
const PluginName = "goravel:telemetry"
Variables ¶
This section is empty.
Functions ¶
func ContextWithTable ¶
ContextWithTable tags ctx with the collection a query targets so the wrapped builder can set db.collection.name for structured queries. Raw SQL omits it.
func WrapBuilder ¶
func WrapBuilder(inner contractsdb.Builder, inst *Instrument) contractsdb.Builder
WrapBuilder wraps a query builder with telemetry. The wrapper resolves telemetry lazily and no-ops until it is active.
func WrapTxBuilder ¶
func WrapTxBuilder(inner contractsdb.TxBuilder, inst *Instrument) contractsdb.TxBuilder
WrapTxBuilder wraps a transaction builder with telemetry.
Types ¶
type GormPlugin ¶
type GormPlugin struct {
// contains filtered or unexported fields
}
func NewGormPlugin ¶
func NewGormPlugin(instrument *Instrument) *GormPlugin
func (*GormPlugin) Initialize ¶
func (r *GormPlugin) Initialize(db *gorm.DB) error
func (*GormPlugin) Name ¶
func (r *GormPlugin) Name() string
type Instrument ¶
type Instrument struct {
// contains filtered or unexported fields
}
func NewInstrument ¶
func NewInstrument(pool contractsdatabase.Pool, connection string, resolver contractstelemetry.Resolver) *Instrument
func (*Instrument) SetDB ¶
func (r *Instrument) SetDB(db *sql.DB)
SetDB stores the primary writer's *sql.DB for pool metrics. Pool metrics cover the writer pool only; dbresolver replica pools are internal gorm.ConnPool instances with no public sql.DBStats access.
func (*Instrument) Shutdown ¶
func (r *Instrument) Shutdown()
Shutdown unregisters the pool-metrics callback and clears the resolved telemetry so the next use re-resolves against the current provider.
Click to show internal directories.
Click to hide internal directories.