Giter Club home page Giter Club logo

newrelic's Introduction

NewRelic Go Agent

A small convenience layer that sits on top of newrelic-go-agent, to make it easy to create transactions for NewRelic in Go.

Caveats

This is alpha software. It has not been tested in a production environment, or any environment for that matter.

Installing

You'll need to install the nr_agent_sdk first.

This package will only work on linux platforms. It is also disabled by default. To enable it, use the build flag newrelic_enabled:

go build -tags newrelic_enabled ./...

Example Usage

See ./example/main.go for a more complete example.

import "github.com/remind101/newrelic"

func main() {
    newrelic.Init("newrelic app name", "newrelic license key")
    tx := newrelic.NewTx("/my/transaction/name")
    tx.Start()
    defer tx.End()

    // Add a segment
    tx.StartGeneric("middleware")
    // Do some middleware stuff...
    tx.EndSegment()
}

Using with an http server

This packages works well as an httpx middleware.

Here is an example using httpx, a context aware http handler.

    r := httpx.NewRouter()

    r.Handle("/articles", &ArticlesHandler{}).Methods("GET")
    r.Handle("/articles/{id}", &ArticleHandler{}).Methods("GET")

    var h httpx.Handler

    // Add NewRelic tracing.
    h = middleware.NewRelicTracing(r, r, &newrelic.NRTxTracer{})

    // Wrap the route in middleware to add a context.Context.
    h = middleware.BackgroundContext(h)

    http.ListenAndServe(":8080", h)

The above example will create web transactions named GET "/articles" and GET "/articles/{id}".

newrelic's People

Contributors

bmarini avatar hamiltop avatar maximelamure avatar sanjayprabhu avatar sergeylanzman avatar v-yarotsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newrelic's Issues

Error Events in APM

It would be super nice to have wrap over Events on Error under the APM tab.
So far, there is only Monitoring tabs that shows the data, but but it would as well be very helpful to track error rates of APIs.

It seems like you have a function called ReportError(tx, ...), but an example of usage would be nice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.