Documentation ¶
Index ¶
- type Hook
- type Option
- func WithAllowRoot(b bool) Option
- func WithDefaultAttributes(attrs ...attribute.KeyValue) Option
- func WithInstanceName(instanceName string) Option
- func WithLastInsertId(b bool) Option
- func WithOptions(options Options) Option
- func WithPing(b bool) Option
- func WithQuery(b bool) Option
- func WithQueryParams(b bool) Option
- func WithResetRession(b bool) Option
- func WithRowsAffected(b bool) Option
- func WithRowsClose(b bool) Option
- func WithRowsNext(b bool) Option
- func WithSpanNameFormatter(formatter func(context.Context, string, string) string) Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
Option allows for managing trace configuration using functional options.
func WithAllowRoot ¶
WithAllowRoot if set to true, will allow hook to create root spans in absence of exisiting spans or even context. Default is to not trace sql calls if no existing parent span is found in context or when using methods not taking context.
func WithDefaultAttributes ¶
WithDefaultAttributes will be set to each span as default.
func WithInstanceName ¶
WithInstanceName sets database instance name.
func WithLastInsertId ¶
WithLastInsertID if set to true, will enable the creation of spans on LastInsertId calls.
func WithOptions ¶
WithOptions sets our hook tracing middleware options through a single Options object.
func WithQuery ¶
WithQuery if set to true, will enable recording of sql queries in spans. Only allow this if it is safe to have queries recorded with respect to security.
func WithQueryParams ¶
WithQueryParams if set to true, will enable recording of parameters used with parametrized queries. Only allow this if it is safe to have parameters recorded with respect to security. This setting is a noop if the Query option is set to false.
func WithResetRession ¶
WithResetSession if seto to true, will enable the creation of spans on ResetSession calls.
func WithRowsAffected ¶
WithRowsAffected if set to true, will enable the creation of spans on RowsAffected calls.
func WithRowsClose ¶
WithRowsClose if set to true, will enable the creation of spans on RowsClose calls.
func WithRowsNext ¶
WithRowsNext if set to true, will enable the creation of spans on RowsNext calls. This can result in many spans.
type Options ¶
type Options struct { // AllowRoot, if set to true, will allow hook to create root spans in // absence of existing spans or even context. // Default is to not trace calls if no existing parent span is found // in context or when using methods not taking context. AllowRoot bool // Query, if set to true, will enable recording of sql queries in spans. // Only allow this if it is safe to have queries recorded with respect to // security. Query bool // QueryParams, if set to true, will enable recording of parameters used // with parametrized queries. Only allow this if it is safe to have // parameters recorded with respect to security. // This setting is a noop if the Query option is set to false. QueryParams bool // Ping, if set to true, will enable the creation of spans on Ping requests. Ping bool // RowsAffected, if set to true, will enable the creation of spans on // RowsAffected calls. RowsAffected bool // LastInsertId, if set to true, will enable the creation of spans on // LastInsertId calls. LastInsertId bool // RowsNext, if set to true, will enable the creation of spans on RowsNext // calls. This can result in many spans. RowsNext bool // RowsClose, if set to true, will enable the creation of spans on RowsClose // calls. RowsClose bool // ResetSession, if set to true, will enable the creation of spans on ResetSession // calls ResetSession bool // SpanNameFormatter will be called to produce span's name. // Default use method as span name SpanNameFormatter func(ctx context.Context, method string, query string) string // DefaultAttributes will be set to each span as default. DefaultAttributes []attribute.KeyValue // InstanceName identifies database. InstanceName string }
Options holds configuration of our tracing hook. By default all options are set to false intentionally when creating a wrapped driver and provide the most sensible default with both performance and security in mind.