NewRelic instrumentation helpers for valyala/fasthttp.
txn := newrelicApp.StartTransaction("test", nil, nil)
defer txn.End()
req := fasthttp.AcquireRequest()
defer fasthttp.ReleaseRequest(req)
resp := fasthttp.AcquireResponse()
defer fasthttp.ReleaseResponse(resp)
proxyClient := &fasthttp.HostClient{
Addr: "localhost:8080",
}
nrfasthttp.Do(proxyClient, txn, req, res)
With buaazp/fasthttprouter:
router.Handle("GET", "/me", nrfasthttp.WrapHandler(newrelicApp, "/me", yourHandler)
router.NotFound = nrfasthttp.WrapHandler(newrelicApp, "404", yourHandler)
Using fastthttp only:
fasthttp.Serve(listener, nrfasthttp.WrapHandler(newrelicApp, "Request", yourHandler))
Getting newrelic.Transaction:
func handler (ctx *fasthttp.RequestCtx) {
txn := ntfasthttp.GetTransaction(ctx)
}
For complete documentation, check here. The API is based on newrelic/go-agent API so usage is very similiar.
See here.