newrelic middleware
⚙️ gearbox requires version 1.14
or higher of Go (Download Go)
Just use go get to download and install gearbox
go get -u github.com/gogearbox/gearbox
go get u- github.com/gogearbox/newrelic
package main
import (
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/gogearbox/gearbox"
newrelicmiddleware "github.com/gogearbox/newrelic"
)
func main() {
// Setup gearbox
gb := gearbox.New()
// Initialize newrelic
nr, _ := newrelic.NewApplication(
newrelic.ConfigAppName(APP_NAME),
newrelic.ConfigLicense(LICENSE),
)
// Register the newrelic middleware for all requests
gb.Use(newrelicmiddleware.New(nr))
// Define your handler
gb.Post("/hello", func(ctx gearbox.Context) {
panic("There is an issue")
})
// Start service
gb.Start(":3000")
}