Skip to content

gogearbox/newrelic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


DeepSource

newrelic middleware

Supported Go versions & installation

⚙️ 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

Examples

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")
}