Documentation ¶
Index ¶
- func New(c DataConf, ctxlog *log.Helper) (*gorm.DB, error)
- func NewWithOptions(c DataConf, opts ...Option) (*gorm.DB, error)
- func WithOmitVariablesFromTrace(ctx context.Context) context.Context
- type Config
- type DataConf
- type GormTracingOption
- type Logger
- func (l *Logger) Error(ctx context.Context, s string, args ...interface{})
- func (l *Logger) Info(ctx context.Context, s string, args ...interface{})
- func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, s string, args ...interface{})
- type Option
- type OtelPlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GormTracingOption ¶
type GormTracingOption interface {
// contains filtered or unexported methods
}
GormTracingOption is used to configure the client.
func WithAlwaysOmitVariables ¶
func WithAlwaysOmitVariables() GormTracingOption
WithAlwaysOmitVariables makes the plugin always omit variable values from traces.
func WithDBName ¶
func WithDBName(name string) GormTracingOption
WithDBName specified the database name to be used in span names since its not possible to extract this information from gorm
func WithTracerProvider ¶
func WithTracerProvider(provider oteltrace.TracerProvider) GormTracingOption
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.
type Logger ¶
type Logger struct { SlowThreshold time.Duration SourceField string SkipCallerLookup bool SkipErrRecordNotFound bool // contains filtered or unexported fields }
func (*Logger) LogMode ¶
func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
type Option ¶
type Option func(*Config)
func WithLogger ¶
WithLogger set gorm-logger and has debug logger writer..
type OtelPlugin ¶
type OtelPlugin struct {
// contains filtered or unexported fields
}
func NewPlugin ¶
func NewPlugin(opts ...GormTracingOption) *OtelPlugin
NewPlugin initialize a new gorm.DB plugin that traces queries You may pass optional Options to the function
func (*OtelPlugin) Initialize ¶
func (op *OtelPlugin) Initialize(db *gorm.DB) error
func (*OtelPlugin) Name ¶
func (op *OtelPlugin) Name() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.