{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/apm-agent-go/issues/665","repository_url":"https://api.github.com/repos/elastic/apm-agent-go","labels_url":"https://api.github.com/repos/elastic/apm-agent-go/issues/665/labels{/name}","comments_url":"https://api.github.com/repos/elastic/apm-agent-go/issues/665/comments","events_url":"https://api.github.com/repos/elastic/apm-agent-go/issues/665/events","html_url":"https://github.com/elastic/apm-agent-go/issues/665","id":511241966,"node_id":"MDU6SXNzdWU1MTEyNDE5NjY=","number":665,"title":"add negroni middleware","user":{"login":"earlzo","id":8749411,"node_id":"MDQ6VXNlcjg3NDk0MTE=","avatar_url":"https://avatars2.githubusercontent.com/u/8749411?v=4","gravatar_id":"","url":"https://api.github.com/users/earlzo","html_url":"https://github.com/earlzo","followers_url":"https://api.github.com/users/earlzo/followers","following_url":"https://api.github.com/users/earlzo/following{/other_user}","gists_url":"https://api.github.com/users/earlzo/gists{/gist_id}","starred_url":"https://api.github.com/users/earlzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/earlzo/subscriptions","organizations_url":"https://api.github.com/users/earlzo/orgs","repos_url":"https://api.github.com/users/earlzo/repos","events_url":"https://api.github.com/users/earlzo/events{/privacy}","received_events_url":"https://api.github.com/users/earlzo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-10-23T10:51:21Z","updated_at":"2019-10-24T03:09:47Z","closed_at":null,"author_association":"NONE","body":"**Is your feature request related to a problem? Please describe.**\r\n\r\nhttps://github.com/urfave/negroni\r\n\r\n> Negroni is an idiomatic approach to web middleware in Go. It is tiny, non-intrusive, and encourages use of net/http Handlers.\r\n\r\nthe `modules/apmhttp` is a little bit inconvenient when we have multiple middlewares.\r\n\r\nthe code using `modules/apmhttp` likes that:\r\n\r\n```go\r\nfunc setupGlobalMiddleware(handler http.Handler) http.Handler {\r\n\treturn sentryhttp.New(sentryhttp.Options{}).Handle(apmhttp.Wrap(handler))\r\n}\r\n```\r\n\r\nNegroni is a good package for `http` compares to web frameworks with middleware support.\r\n\r\n\r\n\r\n**Describe the solution you'd like**\r\n\r\nadd `module/apmnegroni`\r\n\r\n```go\r\nfunc setupGlobalMiddleware(handler http.Handler) http.Handler {\r\n\tn := negroni.New()\r\n\tn.Use(sentrynegroni.New(sentrynegroni.Options{}))\r\n\tn.Use(apmnegroni.Middleware())\r\n\tn.UseHandler(handler)\r\n\treturn n\r\n}\r\n```\r\n\r\n**Additional context**\r\n\r\nI'd like to implement this feature if you accept this feature request"},"comment":{"url":"https://api.github.com/repos/elastic/apm-agent-go/issues/comments/545722548","html_url":"https://github.com/elastic/apm-agent-go/issues/665#issuecomment-545722548","issue_url":"https://api.github.com/repos/elastic/apm-agent-go/issues/665","id":545722548,"node_id":"MDEyOklzc3VlQ29tbWVudDU0NTcyMjU0OA==","user":{"login":"axw","id":843579,"node_id":"MDQ6VXNlcjg0MzU3OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/843579?v=4","gravatar_id":"","url":"https://api.github.com/users/axw","html_url":"https://github.com/axw","followers_url":"https://api.github.com/users/axw/followers","following_url":"https://api.github.com/users/axw/following{/other_user}","gists_url":"https://api.github.com/users/axw/gists{/gist_id}","starred_url":"https://api.github.com/users/axw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axw/subscriptions","organizations_url":"https://api.github.com/users/axw/orgs","repos_url":"https://api.github.com/users/axw/repos","events_url":"https://api.github.com/users/axw/events{/privacy}","received_events_url":"https://api.github.com/users/axw/received_events","type":"User","site_admin":false},"created_at":"2019-10-24T03:09:47Z","updated_at":"2019-10-24T03:09:47Z","author_association":"MEMBER","body":"> Maybe we can provide an optional Routers interface, the agent use it to look up the router path for a request.\r\n\r\nWhen using `apmhttp.Wrap`, you can pass in a function to extract the transaction name from the request, using the option [apmhttp.WithServerRequestName](https://godoc.org/go.elastic.co/apm/module/apmhttp#WithServerRequestName). If you make it possible to pass options into `apmnegroni.Middleware()`, then you could, for example, fetch the route by using `denco.Router.Lookup`.\r\n\r\nFeel free to go ahead with implementing this feature. Thank you!"}}
{"actor":{"display_login":"axw"}}