Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Integrate GORM v1 with Atatus Go Agent to trace database queries and monitor SQL performance in Go applications.
go get go.atatus.com/agent go get go.atatus.com/agent/module/atgorm
import ( "go.atatus.com/agent/module/atgorm" "go.atatus.com/agent" _ "go.atatus.com/agent/module/atgorm/dialects/mysql" ) func main() { // Initialize Atatus tracer using environment variables tracer := atatus.DefaultTracer tracer.Service.LicenseKey = os.Getenv("ATATUS_LICENSE_KEY") tracer.Service.AppName = os.Getenv("ATATUS_APP_NAME") tracer.Service.Tracing = os.Getenv("ATATUS_TRACING") tracer.Service.Analytics = os.Getenv("ATATUS_ANALYTICS") dsn := "user:password@tcp(127.0.0.1:3306)/mydb?parseTime=true" // Open GORM DB with Atatus instrumentation db, err := atgorm.Open(mysql.Open(dsn), &gorm.Config{}) ... } func handleRequest(w http.ResponseWriter, req *http.Request) { // Use DB with context to get Database metrics dbi:=db.WithContext(req.Context()) dbi.Find(...) }
go mod tidy
go run main.go