go-agent: github.com/newrelic/go-agent/v3/integrations/nrgin Index | Files | Directories

package nrgin

import "github.com/newrelic/go-agent/v3/integrations/nrgin"

Package nrgin instruments https://github.com/gin-gonic/gin applications.

Use this package to instrument inbound requests handled by a gin.Engine. Call nrgin.Middleware to get a gin.HandlerFunc which can be added to your application as a middleware:

router := gin.Default()
// Add the nrgin middleware before other middlewares or routes:
router.Use(nrgin.Middleware(app))

Example: https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrgin/example/main.go

Index

Package Files

nrgin.go

func Middleware Uses

func Middleware(app *newrelic.Application) gin.HandlerFunc

Middleware creates a Gin middleware that instruments requests.

router := gin.Default()
// Add the nrgin middleware before other middlewares or routes:
router.Use(nrgin.Middleware(app))

func Transaction Uses

func Transaction(c Context) *newrelic.Transaction

Transaction returns the transaction stored inside the context, or nil if not found.

type Context Uses

type Context interface {
    Value(key interface{}) interface{}
}

Context avoids making this package 1.7+ specific.

Directories

PathSynopsis
example

Package nrgin imports 4 packages (graph) and is imported by 1 packages. Updated 2020-03-24. Refresh now. Tools for package owners.