pg

package
v1.35.12 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 9 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

type Option func(*config)

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

func WithAnalytics

func WithAnalytics(on bool) Option

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate

func WithAnalyticsRate(rate float64) Option

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

func WithServiceName

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