Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takt-corp/gin-newrelic
Gin middleware for tracking NewRelic Web Transactions
https://github.com/takt-corp/gin-newrelic
gin gin-gonic go golang newrelic
Last synced: about 1 month ago
JSON representation
Gin middleware for tracking NewRelic Web Transactions
- Host: GitHub
- URL: https://github.com/takt-corp/gin-newrelic
- Owner: takt-corp
- License: mit
- Created: 2022-10-27T15:54:17.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T23:21:05.000Z (about 1 year ago)
- Last Synced: 2024-11-15T22:43:00.964Z (about 1 month ago)
- Topics: gin, gin-gonic, go, golang, newrelic
- Language: Go
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# NewRelic Middleware for Gin
Gin middleware for tracking NewRelic web requests.
```go
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...
})```