Skip to content

rafaelhl/gorm-newrelic-telemetry-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GORM NewRelic Telemetry Plugin

A plugin to allow telemetry by NewRelic Go Agent for GORM

Overview

Plugin implementation to add datastore segments on a Newrelic transaction injected on Go application context.

Requirements

  • NewRelic Go Agent v3
  • Injected newrelic transaction on context of the app
  • Use WithContext function from gorm.DB passing the context with the transaction

How to use

Install

go get -u github.com/rafaelhl/gorm-newrelic-telemetry-plugin

Quick Start

Since this plugin implements the interface Plugin, just follow the example below available on test file newrelic_test.go:

db := "sqlite.db"
gormDB, err := gorm.Open(sqlite.Open(db), &gorm.Config{})
if err != nil {
	panic(err)
}
err := gormDB.Use(telemetry.NewNrTracer(db, "local", "SQLite"))
assert.NoError(t, err)
gormDB.WithContext(ctx).Create(newEntity)

About

A plugin to allow telemetry by NewRelic Go Agent for GORM

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages