Documentation ¶
Overview ¶
Package gorm provides an OpenTelemetry instrumentation for the GORM library.
More information: https://github.com/go-gorm/opentelemetry
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Logger ¶
Logger returns a GORM log handler that uses the provided base logger to report operations. The `slow` parameter can be used to define the threshold to tag slow operations in ms; if not provided a default value of 200 will be used.
func Open ¶
Open provides a wrapper around the standard sql.Open function to enable SQL commenter instrumentation. When used with GORM the returned `*sql.DB` instance can be used as `gorm.ConnPool`
More information: https://google.github.io/sqlcommenter/go/database_sql/
Types ¶
type Option ¶
type Option func(p *plugin)
Option defines a function that configures the plugin behavior.
func WithAttributes ¶
WithAttributes register additional attributes that will be used when creating spans.
func WithIgnoredError ¶
WithIgnoredError registered errors that should be ignored by the plugin when reporting spans. This is useful to avoid unnecessary reports for common errors like "record not found" or "no rows".
func WithQueryFormatter ¶
WithQueryFormatter configures a query formatter.
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.