10000 GitHub - takt-corp/gin-newrelic: Gin middleware for tracking NewRelic Web Transactions
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

takt-corp/gin-newrelic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NewRelic Middleware for Gin

Gin middleware for tracking NewRelic web requests.

    r := gin.New()

    appName := viper.GetString("NEW_RELIC_APP_NAME")
	licenseKey := viper.GetString("NEW_RELIC_LICENSE_KEY")

	app, err := newrelic.NewApplication(
		newrelic.ConfigAppName(appName),
		newrelic.ConfigLicense(licenseKey),
		newrelic.ConfigDistributedTracerEnabled(true),
		func(cfg *newrelic.Config) {
			cfg.ErrorCollector.RecordPanics = true
		},
	) 

    r.Use(ginnewrelic.NewRelicMiddleware(app))

    r.GET("/", func(c *gin.Context) {
        txn := newrelic.FromContext(c.Request.Context())

        // code...
    })

About

Gin middleware for tracking NewRelic Web Transactions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0