Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greenboxal/nr-fasthttp
NewRelic instrumentation helpers for valyala/fasthttp
https://github.com/greenboxal/nr-fasthttp
Last synced: about 1 month ago
JSON representation
NewRelic instrumentation helpers for valyala/fasthttp
- Host: GitHub
- URL: https://github.com/greenboxal/nr-fasthttp
- Owner: greenboxal
- License: apache-2.0
- Created: 2017-07-22T19:56:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-27T19:30:51.000Z (about 6 years ago)
- Last Synced: 2024-06-20T05:09:58.003Z (6 months ago)
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 5
- Watchers: 4
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nr-fasthttp
NewRelic instrumentation helpers for valyala/fasthttp.
## Usage
### Instrumenting external segments:
```go
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:
```go
router.Handle("GET", "/me", nrfasthttp.WrapHandler(newrelicApp, "/me", yourHandler)router.NotFound = nrfasthttp.WrapHandler(newrelicApp, "404", yourHandler)
```Using fastthttp only:
```go
fasthttp.Serve(listener, nrfasthttp.WrapHandler(newrelicApp, "Request", yourHandler))
```Getting newrelic.Transaction:
```go
func handler (ctx *fasthttp.RequestCtx) {
txn := ntfasthttp.GetTransaction(ctx)
}
```For complete documentation, check [here](https://godoc.org/github.com/greenboxal/nr-fasthttp). The API is based on newrelic/go-agent API so usage is very similiar.
## License
See [here](LICENSE).