hypersql

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 3

README

goagent for database/sql

A SQL wrapper attaching goagent instrumentation

Usage

import (
    "database/sql"
    "github.com/hypertrace/goagent/instrumentation/hypertrace/database/hypersql"
)

// Register our hypersql wrapper for the provided MySQL driver.
driverName, err = hypersql.Register("mysql")
if err != nil {
    log.Fatalf("unable to register goagent driver: %v\n", err)
}

// Connect to a MySQL database using the hypersql driver wrapper.
db, err = sql.Open(driverName, "user:password@/dbname")

You can also wrap your own driver with goagent instrumentation as follows:


import (
    "github.com/go-sql-driver/mysql"
    "github.com/hypertrace/goagent/instrumentation/hypertrace/database/hypersql"
)

// Explicitly wrap the MySQL driver with hypersql
driver := hypersql.Wrap(&mysql.MySQLDriver{})

// Register our hypersql wrapper as a database driver
sql.Register("ht-mysql", driver)

// Connect to a MySQL database using the hypersql driver wrapper
db, err = sql.Open("ht-mysql", "user:password@/dbname")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Register = otelsql.Register

Register initializes and registers the hypersql wrapped database driver identified by its driverName. On success it returns the generated driverName to use when calling sql.Open.

View Source
var Wrap = otelsql.Wrap

Wrap takes a SQL driver and wraps it with Hypertrace instrumentation.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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