@ManagedResource public class ApexMetricsTowerControl extends Object implements IApexMetricsTowerControl, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.cache.LoadingCache<StartMetricEvent,org.joda.time.LocalDateTime> |
activeTasks
Cache the
StartMetricEvent which have not ended yet. |
protected IApexThreadDumper |
apexThreadDumper |
static int |
CACHE_MAX_SIZE
Do not maintain more than this amount of active tasks
|
static int |
CACHE_TIMEOUT_MINUTES
A
StartMetricEvent event will be discarded if we don't receive its EndMetricEvent event after
this amount of time |
static int |
DEFAULT_LONGRUNNINGCHECK_SECONDS |
protected static org.slf4j.Logger |
LOGGER |
protected ScheduledExecutorService |
logLongRunningES |
protected int |
longRunningCheckSeconds |
static String |
PATH_JOINER
MetricRegistry uses a String as Key.
|
protected AtomicReference<ScheduledFuture<?>> |
scheduledFuture |
protected com.google.common.cache.LoadingCache<StartMetricEvent,StartMetricEvent> |
verySlowTasks |
| Constructor and Description |
|---|
ApexMetricsTowerControl(IApexThreadDumper apexThreadDumper) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected NavigableMap<Date,String> |
convertToMapDateString(ConcurrentMap<?,org.joda.time.LocalDateTime> asMap) |
NavigableMap<Date,String> |
getActiveTasks() |
long |
getActiveTasksSize() |
String |
getAllThreads(boolean withoutMonitors)
This ThreadDump tends to be faster as by default, it does not collect monitors
|
int |
getLongRunningCheckSeconds() |
long |
getRootActiveTasksSize() |
protected void |
invalidate(StartMetricEvent startEvent) |
boolean |
invalidateActiveTasks(String name)
In some cases, we may have ghosts active tasks.
|
protected void |
invalidateStartEvent(StartMetricEvent startEvent) |
protected void |
logLongRunningTasks() |
protected void |
logOnDetectingVeryLongTask(StartMetricEvent startEvent) |
protected void |
logOnEndEvent(StartMetricEvent startEvent) |
protected void |
logOnFarTooMuchLongTask(StartMetricEvent startEvent) |
protected Object |
noNewLine(StartMetricEvent key) |
void |
onEndEvent(EndMetricEvent endEvent) |
void |
onStartEvent(StartMetricEvent startEvent)
It also starts a Timer
|
void |
onThrowable(Throwable t) |
protected void |
scheduleLogLongRunningTasks() |
void |
setDoRememberStack(boolean doRememberStack) |
void |
setLongRunningCheckSeconds(int longRunningCheckSeconds) |
protected static final org.slf4j.Logger LOGGER
public static final String PATH_JOINER
public static final int CACHE_TIMEOUT_MINUTES
StartMetricEvent event will be discarded if we don't receive its EndMetricEvent event after
this amount of timepublic static final int CACHE_MAX_SIZE
public static final int DEFAULT_LONGRUNNINGCHECK_SECONDS
protected int longRunningCheckSeconds
protected final com.google.common.cache.LoadingCache<StartMetricEvent,org.joda.time.LocalDateTime> activeTasks
StartMetricEvent which have not ended yet.protected final com.google.common.cache.LoadingCache<StartMetricEvent,StartMetricEvent> verySlowTasks
protected final AtomicReference<ScheduledFuture<?>> scheduledFuture
protected final ScheduledExecutorService logLongRunningES
protected final IApexThreadDumper apexThreadDumper
public ApexMetricsTowerControl(IApexThreadDumper apexThreadDumper)
protected void logOnFarTooMuchLongTask(StartMetricEvent startEvent)
protected void logOnDetectingVeryLongTask(StartMetricEvent startEvent)
protected void logOnEndEvent(StartMetricEvent startEvent)
@ManagedAttribute public int getLongRunningCheckSeconds()
getLongRunningCheckSeconds in interface IApexMetricsTowerControl@ManagedAttribute public void setLongRunningCheckSeconds(int longRunningCheckSeconds)
setLongRunningCheckSeconds in interface IApexMetricsTowerControlpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionprotected void scheduleLogLongRunningTasks()
protected void logLongRunningTasks()
protected Object noNewLine(StartMetricEvent key)
public void onStartEvent(StartMetricEvent startEvent)
startEvent - public void onEndEvent(EndMetricEvent endEvent)
endEvent - mark the task associated to this event as completedpublic void onThrowable(Throwable t)
protected void invalidateStartEvent(StartMetricEvent startEvent)
@ManagedAttribute public long getActiveTasksSize()
getActiveTasksSize in interface IApexMetricsTowerControl@ManagedAttribute public long getRootActiveTasksSize()
getRootActiveTasksSize in interface IApexMetricsTowerControl@ManagedAttribute public NavigableMap<Date,String> getActiveTasks()
getActiveTasks in interface IApexMetricsTowerControlMap from the start date of the currently running operation, to the name of the operationprotected NavigableMap<Date,String> convertToMapDateString(ConcurrentMap<?,org.joda.time.LocalDateTime> asMap)
@ManagedOperation public boolean invalidateActiveTasks(String name)
name - the full name of the activeTask to invalidateprotected void invalidate(StartMetricEvent startEvent)
@ManagedOperation public void setDoRememberStack(boolean doRememberStack)
@ManagedOperation public String getAllThreads(boolean withoutMonitors)
withoutMonitors - if true (default JConsole behavior),it skips monitors and synchronizers which is much faster and
prevent freezing the JVMCopyright © 2014–2017 Pivotal Software, Inc.. All rights reserved.