Documentation ¶
Overview ¶
Package splunkgorm provides instrumentation for the github.com/jinzhu/gorm package.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open opens a traced gorm database connection specified by its database driver name and a driver-specific data source name. The driver must already be registered by the driver package.
Example ¶
package main import ( "log" "github.com/jinzhu/gorm" "github.com/signalfx/splunk-otel-go/instrumentation/github.com/jinzhu/gorm/splunkgorm" ) func main() { // This assumes the instrumented driver, // "github.com/signalfx/splunk-otel-go/instrumentation/github.com/jackc/pgx/splunkpgx", // is imported. That will ensure the driver and the instrumentation setup // for the driver are registered with the appropriate packages. db, err := splunkgorm.Open("pgx", "postgres://localhost/db") if err != nil { log.Fatal(err) } defer func() { if err := db.Close(); err != nil { log.Printf("failed to close db: %v", err) } }() user := struct { gorm.Model Name string }{} // All calls through gorm.DB are now traced. db.Where("name = ?", "jinzhu").First(&user) /* ... */ }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.