{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/Hystrix/issues/333","labels_url":"https://api.github.com/repos/Netflix/Hystrix/issues/333/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/Hystrix/issues/333/comments","events_url":"https://api.github.com/repos/Netflix/Hystrix/issues/333/events","html_url":"https://github.com/Netflix/Hystrix/issues/333","id":47305726,"number":333,"title":"Exposing raw Command Execution Time metrics","user":{"login":"asibs","id":6641867,"avatar_url":"https://avatars.githubusercontent.com/u/6641867?v=3","gravatar_id":"","url":"https://api.github.com/users/asibs","html_url":"https://github.com/asibs","followers_url":"https://api.github.com/users/asibs/followers","following_url":"https://api.github.com/users/asibs/following{/other_user}","gists_url":"https://api.github.com/users/asibs/gists{/gist_id}","starred_url":"https://api.github.com/users/asibs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asibs/subscriptions","organizations_url":"https://api.github.com/users/asibs/orgs","repos_url":"https://api.github.com/users/asibs/repos","events_url":"https://api.github.com/users/asibs/events{/privacy}","received_events_url":"https://api.github.com/users/asibs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Netflix/Hystrix/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Netflix/Hystrix/milestones/11","labels_url":"https://api.github.com/repos/Netflix/Hystrix/milestones/11/labels","id":909573,"number":11,"title":"1.4.0-RC7","description":"RC for 1.4.0.  Mostly small new features","creator":{"login":"mattrjacobs","id":205579,"avatar_url":"https://avatars.githubusercontent.com/u/205579?v=3","gravatar_id":"","url":"https://api.github.com/users/mattrjacobs","html_url":"https://github.com/mattrjacobs","followers_url":"https://api.github.com/users/mattrjacobs/followers","following_url":"https://api.github.com/users/mattrjacobs/following{/other_user}","gists_url":"https://api.github.com/users/mattrjacobs/gists{/gist_id}","starred_url":"https://api.github.com/users/mattrjacobs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattrjacobs/subscriptions","organizations_url":"https://api.github.com/users/mattrjacobs/orgs","repos_url":"https://api.github.com/users/mattrjacobs/repos","events_url":"https://api.github.com/users/mattrjacobs/events{/privacy}","received_events_url":"https://api.github.com/users/mattrjacobs/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":7,"state":"open","created_at":"2014-12-19T00:34:15Z","updated_at":"2015-02-03T21:46:30Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2014-10-30T18:00:51Z","updated_at":"2015-02-03T21:59:27Z","closed_at":null,"body":"I would like to expose the various Hystrix Metrics to an internal monitoring system, and looked at creating a custom HystrixMetricsPublisher. This would work for most of the information I'm interested in, but I could not find a way to expose the command latencies (both the HystrixCommand.run() execution time and the full end-to-end execution including any queuing time, etc).\r\n\r\nAt the moment it doesn't seem possible to expose these raw metrics, only rolling aggregates of mean and percentiles. The reason I'm after the raw metrics is because I have a monitoring system which will track metrics over days / weeks, allowing more fine grained historical analysis than could be achieved by exposing already aggregated data.\r\n\r\nIf this sounds like a useful addition to Hystrix I am happy to fork and implement. Below are some thoughts I had about how this functionality could be implemented, so if this is deemed a suitable & useful addition, any guidance on a preferred approach would be welcome.\r\n\r\n\r\nI first thought I may be able to achieve this by extending HystrixCommandMetrics with my own implementation, but looking at HystrixCommand and AbstractCommand there appears to be no way to change the HystrixCommandMetrics instance used in AbstractCommand. HystrixCommandMetrics ultimately always gets passed in as null to the AbstractCommand constructor, resulting in a call to HystrixCommandMetrics.getInstance(...) in the metrics initialisation block.\r\n\r\nSo one approach would be to replace the call to HystrixCommandMetrics.getInstance(...) in AbstractCommand with a call to a factory, and allow others to set the factory they wish to use, thus allowing people to write their own implementations of HystrixCommandMetrics. This approach may not be desirable though, HystrixCommandMetrics is quite an important class in terms of providing HealthCounts to the CircuitBreaker, so allowing others to override the implementation may be deemed risky.\r\n\r\nAnother approach would be to add one or more methods to HystrixEventNotifier. Something along the lines of a \"markCommandDuration(...)\" method which would then be called from HystrixCommandMetrics.addCommandExecutionTime(...) and HystrixCommandMetrics.addUserThreadExecutionTime(...), allowing a custom HystrixEventNotifier to also see these execution time events (including the time taken) and pass them onto some external monitoring utility. This approach would make use of the existing ability to plugin a custom HystrixEventNotifier."},"comment":{"url":"https://api.github.com/repos/Netflix/Hystrix/issues/comments/72744260","html_url":"https://github.com/Netflix/Hystrix/issues/333#issuecomment-72744260","issue_url":"https://api.github.com/repos/Netflix/Hystrix/issues/333","id":72744260,"user":{"login":"mattrjacobs","id":205579,"avatar_url":"https://avatars.githubusercontent.com/u/205579?v=3","gravatar_id":"","url":"https://api.github.com/users/mattrjacobs","html_url":"https://github.com/mattrjacobs","followers_url":"https://api.github.com/users/mattrjacobs/followers","following_url":"https://api.github.com/users/mattrjacobs/following{/other_user}","gists_url":"https://api.github.com/users/mattrjacobs/gists{/gist_id}","starred_url":"https://api.github.com/users/mattrjacobs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattrjacobs/subscriptions","organizations_url":"https://api.github.com/users/mattrjacobs/orgs","repos_url":"https://api.github.com/users/mattrjacobs/repos","events_url":"https://api.github.com/users/mattrjacobs/events{/privacy}","received_events_url":"https://api.github.com/users/mattrjacobs/received_events","type":"User","site_admin":false},"created_at":"2015-02-03T21:59:27Z","updated_at":"2015-02-03T21:59:27Z","body":"@asibs I want to make sure I understand this properly.  Your point is that all the ```HystrixCommandMetrics``` instance is wired into ```AbstractCommand``` in such a way that there's no way to provide a custom implementation.  Moreover, ```HystrixCommandMetrics``` automatically does aggregation via the ```HystrixRollingNumber``` and ```HystrixRollingPercentile``` instances it contains.\r\n\r\nBecause of those 2 factors, you're not able to generate a metrics stream that contains non-aggregated command timings.\r\n\r\nDid I get that right?\r\n\r\nIf so, that sounds reasonable and would likely require a pluggable ```HystrixCommandMetrics``` implementation.  I'm pushing to get 1.4.0 out the door, and would like to defer this until I've finished that."}}