/gorm-otel

opentelemetry integration with GORM

Primary LanguageGoMIT LicenseMIT

gorm-otel

opentelemetry support for gorm2.

Features

  • Record SQL in span logs.
  • Record Result in span logs.
  • Record Table in span tags.
  • Record Error in span tags and logs.
  • Register Create Query Delete Update Row Raw tracing callbacks.

Get Started

I assume that you already have an opentelemetry Tracer client started in your project.

func main() {
	var db *gorm.DB
	
	db.Use(gormotel.New())
	
	// if you want to use customized tracer instead of opentelemetry.GlobalTracer() which is default,
	// you can use the option WithTracer(yourTracer)
}