Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Gorelic WrapHTTPHandler integration #199

Open
gregorypease280 opened this issue Nov 5, 2016 · 2 comments
Open

[Question] Gorelic WrapHTTPHandler integration #199

gregorypease280 opened this issue Nov 5, 2016 · 2 comments

Comments

@gregorypease280
Copy link

Related to #192

I'm trying to use gorelic's agent.WrapHTTPHandler to monitor individual endpoints however I'm running into issues translating between the http.HandlerFunc and rest.HandlerFunc. I assume it should be possible/fairly easy however I'm still new to golang and not entirely familiar with interfaces and the like.... I would greatly appreciate an example of how to achieve this and I'll put in PR for the readme once I figure it out. Thanks!

@ant0ine
Copy link
Owner

ant0ine commented Nov 5, 2016

Hi,

The return value of api.MakeHandler() is a net/http Handler. Have you tried to give that value to gorelic's agent.WrapHTTPHandler ?

@gregorypease280
Copy link
Author

gregorypease280 commented Nov 7, 2016

Hi ant0ine,

Currently I'm doing exactly that

`router, err := rest.MakeRouter(
        rest.Get("/hb", hb),
        rest.Get("/section/item", thing.GetThings),
        rest.Get("/section/item/:id", thing.GetThing),
    )
    if err != nil {
        log.Fatal(err)
    }
    api.SetApp(router)
    http.ListenAndServe(port, agent.WrapHTTPHandler(api.MakeHandler()))`

Perhaps the problem is on gorelic's side of things but what I would like to do is wrap thing.GetThings, thing.GetThing etc... individually in order to monitor which endpoints are failing etc... through newrelic's APM(which now I'm doubting whether or not gorelic is capable of). I see data come in through the NewRelic plugin page but nothing on APM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants