-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Exposing raw Command Execution Time metrics #333
Comments
FYI that I've seen this but am swamped right now and intend on coming back to this. |
@asibs I want to make sure I understand this properly. Your point is that all the Because of those 2 factors, you're not able to generate a metrics stream that contains non-aggregated command timings. Did I get that right? If so, that sounds reasonable and would likely require a pluggable |
@mattrjacobs Apologies for late reply. Allowing a custom implementation of There are alternative approaches though - allowing users to provide a custom implementation of Hope that all makes sense. Deferring this until after 1.4.0 is fine for me. |
Any updates or further plans on this? My thoughts:
|
Good timing - I have been getting ready to tackle this very problem. An issue is that HystrixCommandMetrics is public, and changing it in a backwards-incompatible way would require a 2.0. From a first glance, the constructor of HystrixCommandMetrics is package-protected and all of the public methods seems sane, so we might actually be OK. I am hoping to start work on this in the next 2 weeks. As I get into the details, I'll put my notes here. If you'd like to get started before me, be my guest :) |
@mattrjacobs Please excuse the delay. I think your (quite impressive) changes will work for me! I also checked for any broken public methods, but couldn't find any as well. If I can assist with any of your TODOs regarding this topic, feel free to assign some tasks :-) |
In master, (and 1.5.0 soon), you can now call @nsowen / @asibs Please take a look and see if this meets your needs. You can see how I retrofit |
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).
At 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.
If 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.
I 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.
So 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.
Another 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.
The text was updated successfully, but these errors were encountered: