Documentation
¶
Overview ¶
Example ¶
package main import ( "context" ddDatabase "github.com/coopnorge/go-datadog-lib/v2/middleware/database" mysqlDriver "github.com/go-sql-driver/mysql" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" ) func main() { ctx := context.Background() dsn := "example.com/users" db, err := ddDatabase.RegisterDriverAndOpen("mysql", mysqlDriver.MySQLDriver{}, dsn) if err != nil { panic(err) } span, ctx := tracer.StartSpanFromContext(ctx, "http.request") defer span.Finish() rows, err := db.QueryContext(ctx, "SELECT * FROM users") if err != nil { span.Finish(tracer.WithError(err)) panic(err) } println(rows) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(cfg *config)
Option allows for overriding our default-config.
func WithChildSpansOnly ¶
WithChildSpansOnly causes spans to be created only when there is an existing parent span in the Context.
func WithCustomTag ¶
WithCustomTag will attach the value to the span tagged by the key.
func WithIgnoreQueryTypes ¶
WithIgnoreQueryTypes specifies the query types for which spans should not be created. Will replace any existing ignored query-types, so it must be an exhaustive list. See available QueryTypes here: https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql#pkg-constants
func WithServiceName ¶
WithServiceName overrides the service-name set in environment-variable "DD_SERVICE".
Click to show internal directories.
Click to hide internal directories.