Documentation
¶
Index ¶
- Variables
- func GetTransaction(ctx iris.Context) *newrelic.Transaction
- func MiddleareWithFullPath(app *newrelic.Application) iris.Handlerdeprecated
- func Middleware(app *newrelic.Application) iris.Handler
- func MiddlewareWithFullPath(app *newrelic.Application) iris.Handler
- func New(app *newrelic.Application) iris.Handler
- func Transaction(ctx Context) *newrelic.Transaction
- type Context
Constants ¶
This section is empty.
Variables ¶
var TransactionContextKey = "newRelicTransaction"
TransactionContextKey is used as the context key in newrelic.New and newrelic.Transaction. Iris requires a string context key. We use two different context keys (and check both in newrelic.Transaction and newrelic.FromContext) rather than use a single string key because context.WithValue will fail golint if used with a string key.
Functions ¶
func GetTransaction ¶
func GetTransaction(ctx iris.Context) *newrelic.Transaction
GetTransaction returns the current request's newrelic transaction. Kept for backwards compatibility, it calls the Transaction function.
func MiddleareWithFullPath
deprecated
func MiddleareWithFullPath(app *newrelic.Application) iris.Handler
MiddleareWithFullPath calls MiddlewareWithFullPath.
Deprecated: the name is misspelled. Use MiddlewareWithFullPath instead.
func Middleware ¶
func Middleware(app *newrelic.Application) iris.Handler
Middleware creates an Iris middleware that instruments requests. Each request is a web transaction named after the request's method and the name of the handler that follows the middleware in the chain. When more middleware is registered after it, that is the next middleware and not the route's handler; MiddlewareWithFullPath names the transaction after the route instead.
import nriris "github.com/iris-contrib/middleware/newrelic" router := iris.New() router.Use(nriris.Middleware(app))
A nil app makes it a handler that only calls the next one.
func MiddlewareWithFullPath ¶
func MiddlewareWithFullPath(app *newrelic.Application) iris.Handler
MiddlewareWithFullPath is the same as Middleware but it names the transaction after the method and the path of the route as it was registered, for example "GET /users/{id:int}", instead of the method and the handler name. A request that matched no route is named after the method and the full request URI.
func New ¶
func New(app *newrelic.Application) iris.Handler
New calls the Middleware(app). Kept for backwards compatibility.
func Transaction ¶
func Transaction(ctx Context) *newrelic.Transaction
Transaction returns the transaction stored inside the context, or nil if not found.