Skip to content
forked from ichizero/nrfiber

New Relic Go Agent integration package for Fiber

License

Notifications You must be signed in to change notification settings

karnotxyz/nrfiber

 
 

Repository files navigation

nrfiber

nrfiber is one of New Relic Go Agent integration packages. It instruments inbound requests through the Fiber framework.

Go Reference Go Report Card

🚀 Install

go get -u github.com/ichizero/nrfiber

🧐 Usage

package main

import (
	"log"
	"net/http"

	"github.com/gofiber/fiber/v2"
	"github.com/ichizero/nrfiber"
	"github.com/newrelic/go-agent/v3/newrelic"
)

func main() {
	nrApp, err := newrelic.NewApplication(
		newrelic.ConfigEnabled(true),
		newrelic.ConfigAppName("nrfiber-example"),
		newrelic.ConfigLicense("license-key"),
	)
	if err != nil {
		log.Fatal(err)
	}

	app := fiber.New()
	app.Use(nrfiber.Middleware(nrApp))

	app.Post("/echo", func(c *fiber.Ctx) error {
		return c.Status(http.StatusOK).Send(c.Request().Body())
	})

	if err := app.Listen(":8000"); err != nil {
		log.Fatal(err)
	}
}

About

New Relic Go Agent integration package for Fiber

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%