{"action":"created","issue":{"url":"https://api.github.com/repos/Backline/akka-http-metrics/issues/13","repository_url":"https://api.github.com/repos/Backline/akka-http-metrics","labels_url":"https://api.github.com/repos/Backline/akka-http-metrics/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/Backline/akka-http-metrics/issues/13/comments","events_url":"https://api.github.com/repos/Backline/akka-http-metrics/issues/13/events","html_url":"https://github.com/Backline/akka-http-metrics/issues/13","id":193817232,"number":13,"title":"HttpTimerMetrics with Future","user":{"login":"mazorigal","id":15340875,"avatar_url":"https://avatars.githubusercontent.com/u/15340875?v=3","gravatar_id":"","url":"https://api.github.com/users/mazorigal","html_url":"https://github.com/mazorigal","followers_url":"https://api.github.com/users/mazorigal/followers","following_url":"https://api.github.com/users/mazorigal/following{/other_user}","gists_url":"https://api.github.com/users/mazorigal/gists{/gist_id}","starred_url":"https://api.github.com/users/mazorigal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mazorigal/subscriptions","organizations_url":"https://api.github.com/users/mazorigal/orgs","repos_url":"https://api.github.com/users/mazorigal/repos","events_url":"https://api.github.com/users/mazorigal/events{/privacy}","received_events_url":"https://api.github.com/users/mazorigal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-12-06T16:24:10Z","updated_at":"2016-12-08T19:48:18Z","closed_at":null,"body":"Hi,\r\n\r\nI have the following code for defining my route:\r\n\r\n```\r\n  val userProfileRoutes = {\r\n    logRequestResult(\"akka-http-user-profile-service\") {\r\n      (get & path(\"raw\" / Segment / Segment)) { (uid, uidType) =>\r\n        timerDirectiveWithName(name(metricBaseName.name, \"inbound\", \"raw\", \"handle\")) {\r\n          responseCodeMetricsWithName(name(metricBaseName.name, \"inbound\", \"raw\", \"handle\"))(executor) {\r\n            complete {\r\n              userProfileApp.getUserProfileRaw(uid, uidType).map[ToResponseMarshallable] {\r\n                case Right(userProfile) => userProfile\r\n                case Left(err) => err match {\r\n                  case errType: UserProfileNotFoundError => NotFound -> CustomErrorPayload(errType)\r\n                  case errType: UserProfileError => InternalServerError -> CustomErrorPayload(errType)\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n```\r\n\r\nthe ```userProfileApp.getUserProfileRaw(uid, uidType).map[ToResponseMarshallable]``` is the part that reads data from the DB and transform it. It also returns a Future.\r\n\r\nIn my Graphite metrics, the mean time for the requests handle (for that route) is significantly lower then the mean time for the data retrieval and transformation from the DB, which obviously make no sense. \r\n\r\nCould it be related to the fact that you are using the simple Timer and not the timeFuture ?\r\n\r\nThanks,"},"comment":{"url":"https://api.github.com/repos/Backline/akka-http-metrics/issues/comments/265836448","html_url":"https://github.com/Backline/akka-http-metrics/issues/13#issuecomment-265836448","issue_url":"https://api.github.com/repos/Backline/akka-http-metrics/issues/13","id":265836448,"user":{"login":"adamdecaf","id":120951,"avatar_url":"https://avatars.githubusercontent.com/u/120951?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdecaf","html_url":"https://github.com/adamdecaf","followers_url":"https://api.github.com/users/adamdecaf/followers","following_url":"https://api.github.com/users/adamdecaf/following{/other_user}","gists_url":"https://api.github.com/users/adamdecaf/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdecaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdecaf/subscriptions","organizations_url":"https://api.github.com/users/adamdecaf/orgs","repos_url":"https://api.github.com/users/adamdecaf/repos","events_url":"https://api.github.com/users/adamdecaf/events{/privacy}","received_events_url":"https://api.github.com/users/adamdecaf/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T19:48:18Z","updated_at":"2016-12-08T19:48:18Z","body":"Sure thing. I've created https://github.com/Backline/akka-http-metrics/pull/14 and will release a new version once that passes. \r\n\r\nThanks! "}}
{"actor":{"display_login":"adamdecaf"}}