gogearbox / newrelic

New Relic Middleware

Home Page:https://gogearbox.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


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

About

New Relic Middleware

https://gogearbox.com

License:MIT License


Languages

Language:Go 100.0%