tracing

package
v0.0.0-...-9735303 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreatAsSpanName  = "xorm:create" // Insert
	QueryAsSpanName  = "xorm:query"  // Get or Find
	CountAsSpanName  = "xorm:count"  // Count
	SumAsSpanName    = "xorm:sum"    // Sum, Sums, SumsInt
	DeleteAsSpanName = "xorm:delete" // Delete
	UpdateAsSpanName = "xorm:update" // Update
	RowAsSpanName    = "xorm:row"    // Rows or Iterate
	RawAsSpanName    = "xorm:raw"    // the raw SQL execution: Query or Exec a SQL string
)

Variables

This section is empty.

Functions

func After

func After(ctx context.Context, driverName, tableName string, rowsAffected int64, tx *xorm.Session, txErr error, opts ...Option)

After collects the trace data after session actions.

func Before

func Before(ctx context.Context, spanName string, tx *xorm.Engine) (context.Context, *xorm.Session)

Before uses the ctx,spanName,engine to start tracer, creates session.

func BeforeWithSession

func BeforeWithSession(ctx context.Context, spanName string, session *xorm.Session) (context.Context, *xorm.Session)

BeforeWithSession uses the ctx,spanName,session to start tracer, creates session.

func Initialize

func Initialize(db *xorm.Engine, opts ...Option)

Initialize initializes the trace,metric.

Types

type Option

type Option func(p *plugin)

func WithAttributes

func WithAttributes(attrs ...attribute.KeyValue) Option

WithAttributes configures attributes that are used to create a span.

func WithDBName

func WithDBName(name string) Option

WithDBName configures a db.name attribute.

func WithDriverName

func WithDriverName(driverName string) Option

WithDriverName configures a db.system attribute.

func WithQueryFormatter

func WithQueryFormatter(queryFormatter func(query string) string) Option

WithQueryFormatter configures a query formatter

func WithTableName

func WithTableName(name string) Option

WithTableName configures a db.sql.table attribute.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider configures a tracer provider that is used to create a tracer.

func WithoutMetrics

func WithoutMetrics() Option

WithoutMetrics prevents DBStats metrics from being reported.

func WithoutQueryVariables

func WithoutQueryVariables() Option

WithoutQueryVariables configures the db.statement attribute to exclude query variables

Jump to

Keyboard shortcuts

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