Skip to content

NewRelic instrumentation helpers for valyala/fasthttp

License

Notifications You must be signed in to change notification settings

yahyrparedes/nr-fasthttp

 
 

Repository files navigation

nr-fasthttp

NewRelic instrumentation helpers for valyala/fasthttp.

Usage

Instrumenting external segments:

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)

Instrumenting web transactions

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.

License

See here.

About

NewRelic instrumentation helpers for valyala/fasthttp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%