com.atlassian.confluence.util.profiling
Class JavaSimonConfluenceMonitoring

java.lang.Object
  extended by com.atlassian.confluence.util.profiling.JavaSimonConfluenceMonitoring
All Implemented Interfaces:
ConfluenceMonitoring, org.springframework.beans.factory.InitializingBean

public class JavaSimonConfluenceMonitoring
extends java.lang.Object
implements ConfluenceMonitoring, org.springframework.beans.factory.InitializingBean

Implementation of ConfluenceMonitoring that uses Java Simon. It is also responsible for enabling and disabling the monitoring based on events.


Field Summary
static java.lang.String DARK_FEATURE_SITE_KEY_FOR_ENABLE_CPU_TIMING
          The Dark Feature Site key for enabling CPU timing.
static java.lang.String DARK_FEATURE_SITE_KEY_FOR_ENABLE_MONITORING
          The Dark Feature Site key for enabling monitoring.
 
Constructor Summary
JavaSimonConfluenceMonitoring(org.javasimon.Manager manager, DarkFeaturesManager darkFeaturesMgr, com.atlassian.event.api.EventPublisher eventPublisher, int maxEntries)
           
 
Method Summary
 void afterPropertiesSet()
           
 java.lang.String createName(java.lang.String name, java.lang.String... optional)
          Creates a legal name from the supplied mandatory suggestion, and optional extra parts.
 Counter fetchCounter(java.lang.String name, java.lang.String... optional)
          Fetches the counter associated with the supplied name details.
 void onPluginFrameworkStartedEvent(PluginFrameworkStartedEvent event)
           
 void onSiteDarkFeatureDisabledEvent(SiteDarkFeatureDisabledEvent event)
           
 void onSiteDarkFeatureEnabledEvent(SiteDarkFeatureEnabledEvent event)
           
 Split startSplit(java.lang.String name, java.lang.String... optional)
          Creates and starts a split timer associated with the supplied name details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DARK_FEATURE_SITE_KEY_FOR_ENABLE_MONITORING

public static final java.lang.String DARK_FEATURE_SITE_KEY_FOR_ENABLE_MONITORING
The Dark Feature Site key for enabling monitoring.

See Also:
Constant Field Values

DARK_FEATURE_SITE_KEY_FOR_ENABLE_CPU_TIMING

public static final java.lang.String DARK_FEATURE_SITE_KEY_FOR_ENABLE_CPU_TIMING
The Dark Feature Site key for enabling CPU timing.

See Also:
Constant Field Values
Constructor Detail

JavaSimonConfluenceMonitoring

public JavaSimonConfluenceMonitoring(org.javasimon.Manager manager,
                                     DarkFeaturesManager darkFeaturesMgr,
                                     com.atlassian.event.api.EventPublisher eventPublisher,
                                     int maxEntries)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

fetchCounter

public Counter fetchCounter(java.lang.String name,
                            java.lang.String... optional)
Description copied from interface: ConfluenceMonitoring
Fetches the counter associated with the supplied name details. The name is constructed calling ConfluenceMonitoring.createName(String, String...).

Specified by:
fetchCounter in interface ConfluenceMonitoring
Parameters:
name - the mandatory suggested name
optional - the optional parts to concatenate with the mandatory suggestion
Returns:
the counter associated with the name.

startSplit

public Split startSplit(java.lang.String name,
                        java.lang.String... optional)
Description copied from interface: ConfluenceMonitoring
Creates and starts a split timer associated with the supplied name details. The name is constructed calling ConfluenceMonitoring.createName(String, String...).

The typical usage is:

 final Split split = instance.startSplit("name");
 try {
     // code to execute
 }
 finally {
     split.close();
 }
 

Under Java 7, the following is also possible:

 try (Split split = instance.startSplit("name")) {
     // code to execute
 }
 

Specified by:
startSplit in interface ConfluenceMonitoring
Parameters:
name - the mandatory suggested name
optional - the optional parts to concatenate with the mandatory suggestion
Returns:
the running split timer

createName

public java.lang.String createName(java.lang.String name,
                                   java.lang.String... optional)
Description copied from interface: ConfluenceMonitoring
Creates a legal name from the supplied mandatory suggestion, and optional extra parts.

The method is provided for the case where the caller wants to pre-compute the name. For example, it maybe more efficient to generate the name once, to be re-used many times. Typically, this method will not be used.

The algorithm used is very simple:


onPluginFrameworkStartedEvent

@EventListener
public void onPluginFrameworkStartedEvent(PluginFrameworkStartedEvent event)

onSiteDarkFeatureEnabledEvent

@EventListener
public void onSiteDarkFeatureEnabledEvent(SiteDarkFeatureEnabledEvent event)

onSiteDarkFeatureDisabledEvent

@EventListener
public void onSiteDarkFeatureDisabledEvent(SiteDarkFeatureDisabledEvent event)


Copyright © 2003-2014 Atlassian. All Rights Reserved.