contrib/gorm.io/gorm.v1

Those integration are enabled by having the following import in the project’s orchestrion.tool.go file:

import (
	_ "github.com/DataDog/orchestrion"

	_ "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorm.io/gorm.v1" // integration
	//...
)

The fantastic ORM library for Golang.

Open

Join Point
Call to gorm.Open
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	gorm "gorm.io/gorm"
	gormtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorm.io/gorm.v1"
)
func() (*gorm.DB, error) {
	db, err := {{ . }}
	if err != nil {
		return nil, err
	}
	if err := db.Use(gormtrace.NewTracePlugin()); err != nil {
		return nil, err
	}
	return db, nil
}()