Class MonitoringController

java.lang.Object
kieker.monitoring.core.controller.AbstractController
kieker.monitoring.core.controller.MonitoringController
All Implemented Interfaces:
IMonitoringRecordReceiver, IMonitoringController, IProbeController, IRemoteController, ISamplingController, IStateController, IStateListener, ITimeSourceController, IWriterController

public final class MonitoringController extends AbstractController implements IMonitoringController, IStateListener
Since:
1.3
Author:
Jan Waller
  • Method Details

    • createInstance

      public static MonitoringController createInstance(Configuration configuration)
      This is a factory method creating a new monitoring controller instance using the given configuration.
      Parameters:
      configuration - The configuration for the new controller.
      Returns:
      A new controller.
    • getVersion

      public static String getVersion()
      Return the version name of this controller instance.
      Returns:
      the version name
    • beforeEnableMonitoring

      public void beforeEnableMonitoring()
      Description copied from interface: IStateListener
      Triggers if the monitoring is guaranteed to be enabled, but has not yet been published to other threads. This method is provided especially to guarantee that the meta data record is sent before any other record.
      Specified by:
      beforeEnableMonitoring in interface IStateListener
    • init

      protected void init()
      Description copied from class: AbstractController
      This method should to the initialization work.
      Specified by:
      init in class AbstractController
    • cleanup

      protected void cleanup()
      Description copied from class: AbstractController
      This method should clean up.
      Specified by:
      cleanup in class AbstractController
    • toString

      public String toString()
      Description copied from interface: IMonitoringController
      This method is used to log the status of the controllers to the console. It is included in this interface to ensure its publication over JMX.
      Specified by:
      toString in interface IMonitoringController
      Specified by:
      toString in class AbstractController
      Returns:
      a String representation of the current controller
    • sendMetadataAsRecord

      public boolean sendMetadataAsRecord()
      This method sends the meta data (like the controller and host name, the experiment ID, etc.) as a record.
      Specified by:
      sendMetadataAsRecord in interface IMonitoringController
      Returns:
      true on success; false in case of an error.
    • getSamplingController

      protected SamplingController getSamplingController()
    • terminateMonitoring

      public boolean terminateMonitoring()
      Description copied from interface: IStateController
      Permanently terminates monitoring.
      Specified by:
      terminateMonitoring in interface IStateController
      Returns:
      true if now terminated; false if already terminated
      See Also:
    • isMonitoringTerminated

      public boolean isMonitoringTerminated()
      Description copied from interface: IStateController
      Returns whether monitoring is permanently terminated.
      Specified by:
      isMonitoringTerminated in interface IStateController
      Returns:
      true if monitoring is permanently terminated, false if monitoring is enabled or disabled.
      See Also:
    • enableMonitoring

      public boolean enableMonitoring()
      Description copied from interface: IStateController
      Enables monitoring.
      Specified by:
      enableMonitoring in interface IStateController
      Returns:
      true if monitoring is enabled, false otherwise
    • disableMonitoring

      public boolean disableMonitoring()
      Description copied from interface: IStateController
      Disables monitoring. If monitoring is disabled, the MonitoringController simply pauses. Furthermore, probes should stop collecting new data and monitoring writers stop should stop writing existing data.
      Specified by:
      disableMonitoring in interface IStateController
      Returns:
      true if monitoring is disabled, false otherwise
    • isMonitoringEnabled

      public boolean isMonitoringEnabled()
      Description copied from interface: IStateController
      Returns whether monitoring is enabled or disabled/terminated.
      Specified by:
      isMonitoringEnabled in interface IStateController
      Returns:
      true of monitoring is enabled, false if monitoring is disabled or terminated.
      See Also:
    • isDebug

      public boolean isDebug()
      Description copied from interface: IStateController
      Is the debug mode enabled?

      Debug mode is for internal use only and changes a few internal id generation mechanisms to enable easier debugging. Additionally, it is possible to enable debug logging in the settings of the used logger.

      Specified by:
      isDebug in interface IStateController
      Returns:
      debug mode
    • getName

      public String getName()
      Description copied from interface: IStateController
      Returns the name of this controller.
      Specified by:
      getName in interface IStateController
      Returns:
      String
    • getHostname

      public String getHostname()
      Description copied from interface: IStateController
      The hostname will be part of the monitoring data and allows to distinguish observations in cases where the software system is deployed on more than one host. When you want to distinguish multiple Virtual Machines on one host, you* have to set the hostname manually in the Configuration.
      Specified by:
      getHostname in interface IStateController
      Returns:
      The hostname.
    • getApplicationName

      public String getApplicationName()
      Description copied from interface: IMonitoringController
      This method returns the application name stored in the controller.
      Specified by:
      getApplicationName in interface IMonitoringController
      Returns:
      the application name
    • incExperimentId

      public int incExperimentId()
      Description copied from interface: IStateController
      Increments the experiment ID by 1 and returns the new value.
      Specified by:
      incExperimentId in interface IStateController
      Returns:
      experimentID
    • setExperimentId

      public void setExperimentId(int newExperimentID)
      Description copied from interface: IStateController
      Sets the experiment ID to the given value.
      Specified by:
      setExperimentId in interface IStateController
      Parameters:
      newExperimentID - The new ID.
    • getExperimentId

      public int getExperimentId()
      Specified by:
      getExperimentId in interface IStateController
      Returns:
      The experiment ID.
    • newMonitoringRecord

      public boolean newMonitoringRecord(IMonitoringRecord record)
      Description copied from interface: IWriterController

      Called for each new record to write it out to the pre-configured target (e.g., file system, database, or messaging queue). This method could invoke the given record's methods declared in IMonitoringRecord and thus alter its loggingTimestamp property.

      Notice, that this method should not throw an exception, but indicate an error by the return value false.

      Specified by:
      newMonitoringRecord in interface IMonitoringRecordReceiver
      Specified by:
      newMonitoringRecord in interface IWriterController
      Parameters:
      record - the record.
      Returns:
      true on success; false in case of an error.
    • waitForTermination

      public void waitForTermination(long timeoutInMs) throws InterruptedException
      Description copied from interface: IWriterController
      Waits for the termination of the monitoring controller. The termination must be previously triggered by terminateMonitoring().
      Specified by:
      waitForTermination in interface IWriterController
      Parameters:
      timeoutInMs - timeout in milliseconds to wait (a timeout of 0 means to wait forever)
      Throws:
      InterruptedException - if the calling thread was interrupted while waiting for the termination
    • schedulePeriodicSampler

      public ScheduledSamplerJob schedulePeriodicSampler(ISampler sampler, long initialDelay, long period, TimeUnit timeUnit)
      Description copied from interface: ISamplingController
      Schedules the given ISampler with given initial delay, and period.
      Specified by:
      schedulePeriodicSampler in interface ISamplingController
      Parameters:
      sampler - The sampler to schedule.
      initialDelay - The initial delay.
      period - The period.
      timeUnit - The time unit which determines how to interpret the given parameter.
      Returns:
      a ScheduledSamplerJob as a handler for removing the scheduled sampler later on by using the method ISamplingController.removeScheduledSampler(ScheduledSamplerJob).
    • removeScheduledSampler

      public boolean removeScheduledSampler(ScheduledSamplerJob sampler)
      Description copied from interface: ISamplingController
      Stops future executions of the given periodic ScheduledSamplerJob .
      Specified by:
      removeScheduledSampler in interface ISamplingController
      Parameters:
      sampler - The sampler to be removed.
      Returns:
      true if the sensor is not registered
    • getTimeSource

      public ITimeSource getTimeSource()
      Description copied from interface: ITimeSourceController
      Returns the ITimeSource used in this controller.
      Specified by:
      getTimeSource in interface ITimeSourceController
      Returns:
      ITimeSource
    • getControllerDomain

      public String getControllerDomain()
      Specified by:
      getControllerDomain in interface IRemoteController
      Returns:
      the domain used by the controller
    • activateProbe

      public boolean activateProbe(String pattern)
      Description copied from interface: IProbeController
      Activates a probe.
      Specified by:
      activateProbe in interface IProbeController
      Parameters:
      pattern - pattern for the probe
      Returns:
      true on success
    • deactivateProbe

      public boolean deactivateProbe(String pattern)
      Description copied from interface: IProbeController
      Deactivates a probe.
      Specified by:
      deactivateProbe in interface IProbeController
      Parameters:
      pattern - pattern for the probe
      Returns:
      true on success
    • isProbeActivated

      public boolean isProbeActivated(String signature)
      Description copied from interface: IProbeController
      Tests if a probe is active. This test is ignorant of the fact whether monitoring itself is enabled/disabled/terminated.
      Specified by:
      isProbeActivated in interface IProbeController
      Parameters:
      signature - signature of the probe
      Returns:
      true if the probe with this signature is active
    • setProbePatternList

      public void setProbePatternList(List<String> patternList)
      Description copied from interface: IProbeController
      Overwrites the current list of patterns with a new pattern list.
      Specified by:
      setProbePatternList in interface IProbeController
      Parameters:
      patternList - list of strings with patterns where each string starts either with a + or -. The list can be empty (in which case the internal pattern list and the internal cache are cleared) - but not null.
    • getProbePatternList

      public List<String> getProbePatternList()
      Description copied from interface: IProbeController
      Returns the current list of patterns with a prefix indicating whether the pattern is active or not.
      Specified by:
      getProbePatternList in interface IProbeController
      Returns:
      list of strings with patterns where each string starts either with a + or -
    • getAllPatternParameters

      public Map<String,List<String>> getAllPatternParameters(String pattern)
      Description copied from interface: IProbeController
      Looks up the parameters for a probe /the pattern of the probe and returns them, may be null.
      Specified by:
      getAllPatternParameters in interface IProbeController
      Parameters:
      pattern - The pattern of the probe.
      Returns:
      The parameters of the probe, may be null.
    • deletePatternParameter

      public void deletePatternParameter(String pattern, String parameterName)
      Description copied from interface: IProbeController
      Deletes a parameter from the given pattern.
      Specified by:
      deletePatternParameter in interface IProbeController
      Parameters:
      pattern - The parameters to be deleted.
      parameterName - The name of the parameter.
    • clearPatternParameters

      public void clearPatternParameters(String pattern)
      Description copied from interface: IProbeController
      Deletes all parameters from the given pattern.
      Specified by:
      clearPatternParameters in interface IProbeController
      Parameters:
      pattern - The parameters to be deleted.
    • addPatternParameter

      public void addPatternParameter(String pattern, String parameterName, List<String> parameters)
      Description copied from interface: IProbeController
      Adds or updates a parameter for the given pattern.
      Specified by:
      addPatternParameter in interface IProbeController
      Parameters:
      pattern - The pattern of the probe.
      parameterName - The name of the parameter.
      parameters - a List of entries for this parameter.
    • addPatternParameterValue

      public void addPatternParameterValue(String pattern, String name, String value)
      Description copied from interface: IProbeController
      Add one value to a list of parameter values for a pattern.
      Specified by:
      addPatternParameterValue in interface IProbeController
      Parameters:
      pattern - identifying the pattern for the parameter
      name - name of the parameter
      value - value to be added to the list of parameter values.
    • removePatternParameterValue

      public void removePatternParameterValue(String pattern, String name, String value)
      Description copied from interface: IProbeController
      Remove one value to a list of parameter values for a pattern.
      Specified by:
      removePatternParameterValue in interface IProbeController
      Parameters:
      pattern - identifying the pattern for the parameter
      name - name of the parameter
      value - value to be removed from the list of parameter values.
    • getInstance

      public static IMonitoringController getInstance()