pg

package
v1.65.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Example
conn := pg.Connect(&pg.Options{
	User:     "go-pg-test",
	Database: "datadog",
})

// Wrap the connection with the APM hook.
pgtrace.Wrap(conn)
var user struct {
	Name string
}
_, err := conn.QueryOne(&user, "SELECT name FROM users")
if err != nil {
	log.Fatal(err)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(db *pg.DB, opts ...Option)

Wrap augments the given DB with tracing.

Types

type Option added in v1.32.0

type Option func(*config)

Option represents an option that can be used to create or wrap a client.

func WithAnalytics added in v1.32.0

func WithAnalytics(on bool) Option

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate added in v1.32.0

func WithAnalyticsRate(rate float64) Option

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithServiceName added in v1.32.0

func WithServiceName(name string) Option

WithServiceName sets the given service name for the client.

Jump to

Keyboard shortcuts

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