Skip to content
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

Add HystrixCounters methods to return number of commands/threadpools/groups #775

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,9 @@ public String name() {
}

}

/* package-private */ static int getGroupCount() {
return intern.size();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public String name() {
}

}

/* package-private */ static int getCommandCount() {
return intern.size();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import java.util.concurrent.atomic.AtomicInteger;

/**
* Class with global statistics on Hystrix runtime behavior.
* All of the data available via this class is static and scoped at the JVM level
*/
public class HystrixCounters {
private static final AtomicInteger concurrentThreadsExecuting = new AtomicInteger(0);

Expand All @@ -13,7 +17,35 @@ public class HystrixCounters {
concurrentThreadsExecuting.decrementAndGet();
}

/**
* Return the number of currently-executing Hystrix threads
* @return number of currently-executing Hystrix threads
*/
public static int getGlobalConcurrentThreadsExecuting() {
return concurrentThreadsExecuting.get();
}

/**
* Return the number of unique {@link HystrixCommand}s that have been registered
* @return number of unique {@link HystrixCommand}s that have been registered
*/
public static int getCommandCount() {
return HystrixCommandKey.Factory.getCommandCount();
}

/**
* Return the number of unique {@link HystrixThreadPool}s that have been registered
* @return number of unique {@link HystrixThreadPool}s that have been registered
*/
public static int getThreadPoolCount() {
return HystrixThreadPoolKey.Factory.getThreadPoolCount();
}

/**
* Return the number of unique {@link HystrixCommandGroupKey}s that have been registered
* @return number of unique {@link HystrixCommandGroupKey}s that have been registered
*/
public static int getGroupCount() {
return HystrixCommandGroupKey.Factory.getGroupCount();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,9 @@ public String name() {
}

}

/* package-private */ static int getThreadPoolCount() {
return intern.size();
}
}
}