otelsql

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: BSD-2-Clause Imports: 13 Imported by: 2

README

PkgGoDev

OpenTelemetry Go instrumentation for database/sql package

Moved to https://github.com/uptrace/opentelemetry-go-extra/tree/main/otelsql

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(driverName, dsn string, opts ...Option) (*sql.DB, error)

Open is a wrapper over sql.Open that instruments the sql.DB to record executed queries using OpenTelemetry API.

func OpenDB

func OpenDB(connector driver.Connector, opts ...Option) *sql.DB

OpenDB is a wrapper over sql.OpenDB that instruments the sql.DB to record executed queries using OpenTelemetry API.

func PatchDB added in v1.0.4

func PatchDB(db *sql.DB, dsn string, opts ...Option) (*sql.DB, error)

func ReportDBStatsMetrics added in v1.0.4

func ReportDBStatsMetrics(db *sql.DB, opts ...Option)

ReportDBStatsMetrics reports DBStats metrics using OpenTelemetry Metrics API.

Types

type Option

type Option func(c *config)

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 WithDBSystem

func WithDBSystem(system string) Option

WithDBSystem configures a db.system attribute. You should prefer using WithAttributes and semconv, for example, `otelsql.WithAttributes(semconv.DBSystemSqlite)`.

func WithMeter added in v1.0.4

func WithMeter(meter metric.Meter) Option

WithMeter configures a metric.Meter used to create instruments.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

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

Directories

Path Synopsis
e2e module
example module

Jump to

Keyboard shortcuts

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