ocgormv2

package
v0.0.0-...-75c62e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultViews = ocgorm.DefaultViews
)

Functions

func RecordStats

func RecordStats(db *gorm.DB, interval time.Duration) (fnStop func())

RecordStats records database statistics for provided sql.DB at the provided interval. You should defer execution of this function after you establish connection to the database `if err == nil { ocgorm.RecordStats(db, 5*time.Second); }

func RegisterAllViews

func RegisterAllViews()

RegisterAllViews registers all ocgorm views to enable collection of stats.

func RegisterCallbacks

func RegisterCallbacks(db *gorm.DB, opts ...Option) error

RegisterCallbacks registers the necessary callbacks in Gorm's hook system for instrumentation.

func WithContext

func WithContext(ctx context.Context, db *gorm.DB) *gorm.DB

WithContext sets the current context in the db instance for instrumentation. Deprecated: prefer direct usage of db.WithContext(ctx).

Types

type AllowRoot

type AllowRoot bool

AllowRoot allows creating root spans in the absence of existing spans.

type DefaultAttributes

type DefaultAttributes []trace.Attribute

DefaultAttributes sets attributes to each span.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option allows for managing ocgorm configuration using functional options.

func StartOptions

func StartOptions(o trace.StartOptions) Option

StartOptions configures the initial options applied to a span.

type OptionFunc

type OptionFunc func(c *callbacks)

OptionFunc converts a regular function to an Option if it's definition is compatible.

type Query

type Query bool

Query allows recording the sql queries in spans.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL