Documentation
¶
Overview ¶
Package nrfiber instruments https://github.com/gofiber/fiber applications.
Use this package to instrument inbound requests handled by a fiber.App. Call nrfiber.Middleware to get a fiber.Handler which can be added to your application as a middleware:
app := fiber.New() // Add the nrfiber middleware before other middlewares or routes: app.Use(nrfiber.Middleware(newrelicApp))
Example: https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrfiber/example/main.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
func FromContext(c *fiber.Ctx) *newrelic.Transaction
FromContext extracts a New Relic transaction from a Fiber context.
func Middleware ¶
func Middleware(app *newrelic.Application) fiber.Handler
Middleware creates a Fiber middleware handler that instruments requests with New Relic. It starts a New Relic transaction for each request, sets web request and response details, and handles error tracking. If no New Relic application is configured, it passes the request through.
router := fiber.New() // Add the nrfiber middleware before other middlewares or routes: router.Use(nrfiber.Middleware(app))
func Transaction ¶
func Transaction(ctx context.Context) *newrelic.Transaction
Transaction returns the Transaction from the context if it exists.
func WrapHandler ¶
WrapHandler wraps an existing Fiber handler with New Relic instrumentation
fiberApp := fiber.New()
wrappedHandler := WrapHandler(app.Application, "/wrapped", func(c *fiber.Ctx) error {
return c.SendString("Wrapped Handler")
})
fiberApp.Get("/wrapped", wrappedHandler)
Types ¶
This section is empty.