Changes to support calculation wall-clock time taken by a set of hystrix commands

Added in support for calculation wall-clock time taken by a set of hystrix commands usually within the scope of a request.

Use-Case:
We develop and own a service say postUserComments which in turn depends on a set of independent services say
1. detectSpammyURLInContent
2. detectAbuse
3. postToTwitter
4. buildSecondaryIndices
5. ....

All but buildSecondaryIndices are external services that are beyond the scope of current service/system. These are executed in parallel or in sequence depending upon service semantics.

The added feature will help capture true "wall-clock" overhead of postUserComments service, which can be used by service implementations to monitor/alert and optimize on SLA's guaranteed by services.
Thought about it :-), the execution time is in millis, so the option was
use nanos to and then convert it to millis and then get the start time in
ms wasn't achieving any thing substantially better.

I am open to ideas on using nanos if  it is significantly better though, it
is really small change really.


May be we could modify the API's consistently in a way where report in
millis and micros (depending upon what the caller asks), if this has been a
need that has been expressed by the community.





On Sun, Dec 14, 2014 at 9:02 AM, Matt Ball <notifications@github.com> wrote:
>
> In hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java
> <https://github.com/Netflix/Hystrix/pull/356#discussion-diff-21797497>:
>
> > @@ -1401,6 +1402,12 @@ private ExecutionResult(List<HystrixEventType> events, int executionTime, Except
> >              // because we control the original list in 'newEvent'
> >              this.events = events;
> >              this.executionTime = executionTime;
> > +            if (executionTime >= 0 ) {
> > +                this.commandRunStartTime = System.currentTimeMillis() - this.executionTime;
>
> Consider using System.nanoTime() for execution timing.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Netflix/Hystrix/pull/356/files#r21797497>.
>


-- 
--
*Regards,*
*Praveen Ramachandra*