public final class MonitoringController extends AbstractController implements IMonitoringController, IStateListener
monitoringController| Modifier and Type | Method and Description |
|---|---|
boolean |
activateProbe(java.lang.String pattern)
Activates a probe.
|
void |
addPatternParameter(java.lang.String pattern,
java.lang.String parameterName,
java.util.List<java.lang.String> parameters)
Adds or updates a parameter for the given pattern.
|
void |
addPatternParameterValue(java.lang.String pattern,
java.lang.String name,
java.lang.String value)
Add one value to a list of parameter values for a pattern.
|
void |
beforeEnableMonitoring()
Triggers if the monitoring is guaranteed to be enabled, but has not yet been published to other threads.
|
protected void |
cleanup()
This method should clean up.
|
void |
clearPatternParameters(java.lang.String pattern)
Deletes all parameters from the given pattern.
|
static MonitoringController |
createInstance(Configuration configuration)
This is a factory method creating a new monitoring controller instance using
the given configuration.
|
boolean |
deactivateProbe(java.lang.String pattern)
Deactivates a probe.
|
void |
deletePatternParameter(java.lang.String pattern,
java.lang.String parameterName)
Deletes a parameter from the given pattern.
|
boolean |
disableMonitoring()
Disables monitoring.
|
boolean |
enableMonitoring()
Enables monitoring.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getAllPatternParameters(java.lang.String pattern)
Looks up the parameters for a probe /the pattern of the probe and returns
them, may be null.
|
java.lang.String |
getApplicationName()
This method returns the application name stored in the controller.
|
java.lang.String |
getControllerDomain() |
int |
getExperimentId() |
java.lang.String |
getHostname()
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.
|
static IMonitoringController |
getInstance() |
java.lang.String |
getName()
Returns the name of this controller.
|
java.util.List<java.lang.String> |
getProbePatternList()
Returns the current list of patterns with a prefix indicating whether the
pattern is active or not.
|
protected SamplingController |
getSamplingController() |
ITimeSource |
getTimeSource()
Returns the ITimeSource used in this controller.
|
static java.lang.String |
getVersion()
Return the version name of this controller instance.
|
int |
incExperimentId()
Increments the experiment ID by 1 and returns the new value.
|
protected void |
init()
This method should to the initialization work.
|
boolean |
isDebug()
Is the debug mode enabled?
|
boolean |
isMonitoringEnabled()
Returns whether monitoring is enabled or disabled/terminated.
|
boolean |
isMonitoringTerminated()
Returns whether monitoring is permanently terminated.
|
boolean |
isProbeActivated(java.lang.String signature)
Tests if a probe is active.
|
boolean |
newMonitoringRecord(IMonitoringRecord record)
Called for each new record to write it out to the pre-configured target (e.g., file system, database, or messaging queue).
|
void |
removePatternParameterValue(java.lang.String pattern,
java.lang.String name,
java.lang.String value)
Remove one value to a list of parameter values for a pattern.
|
boolean |
removeScheduledSampler(ScheduledSamplerJob sampler)
Stops future executions of the given periodic
ScheduledSamplerJob . |
ScheduledSamplerJob |
schedulePeriodicSampler(ISampler sampler,
long initialDelay,
long period,
java.util.concurrent.TimeUnit timeUnit)
Schedules the given
ISampler with given initial delay, and period. |
boolean |
sendMetadataAsRecord()
This method sends the meta data (like the controller and host name, the
experiment ID, etc.) as a record.
|
void |
setExperimentId(int newExperimentID)
Sets the experiment ID to the given value.
|
void |
setProbePatternList(java.util.List<java.lang.String> patternList)
Overwrites the current list of patterns with a new pattern list.
|
boolean |
terminateMonitoring()
Permanently terminates monitoring.
|
java.lang.String |
toString()
This method is used to log the status of the controllers to the console.
|
void |
waitForTermination(long timeoutInMs)
Waits for the termination of the monitoring controller.
|
createAndInitialize, isTerminated, setMonitoringController, terminatepublic static final MonitoringController createInstance(Configuration configuration)
configuration - The configuration for the new controller.public static final java.lang.String getVersion()
public void beforeEnableMonitoring()
IStateListenerbeforeEnableMonitoring in interface IStateListenerprotected final void init()
AbstractControllerinit in class AbstractControllerprotected final void cleanup()
AbstractControllercleanup in class AbstractControllerpublic final java.lang.String toString()
IMonitoringControllertoString in interface IMonitoringControllertoString in class AbstractControllerpublic final boolean sendMetadataAsRecord()
sendMetadataAsRecord in interface IMonitoringControllerprotected SamplingController getSamplingController()
public final boolean terminateMonitoring()
IStateControllerterminateMonitoring in interface IStateControllerIStateController.isMonitoringTerminated()public final boolean isMonitoringTerminated()
IStateControllerisMonitoringTerminated in interface IStateControllerIStateController.terminateMonitoring()public final boolean enableMonitoring()
IStateControllerenableMonitoring in interface IStateControllerpublic final boolean disableMonitoring()
IStateControllerdisableMonitoring in interface IStateControllerpublic final boolean isMonitoringEnabled()
IStateControllerisMonitoringEnabled in interface IStateControllerIStateController.disableMonitoring(),
IStateController.enableMonitoring()public final boolean isDebug()
IStateControllerDebug 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.
isDebug in interface IStateControllerpublic final java.lang.String getName()
IStateControllergetName in interface IStateControllerpublic final java.lang.String getHostname()
IStateControllergetHostname in interface IStateControllerpublic java.lang.String getApplicationName()
IMonitoringControllergetApplicationName in interface IMonitoringControllerpublic final int incExperimentId()
IStateControllerincExperimentId in interface IStateControllerpublic final void setExperimentId(int newExperimentID)
IStateControllersetExperimentId in interface IStateControllernewExperimentID - The new ID.public final int getExperimentId()
getExperimentId in interface IStateControllerpublic final boolean newMonitoringRecord(IMonitoringRecord record)
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.
newMonitoringRecord in interface IMonitoringRecordReceivernewMonitoringRecord in interface IWriterControllerrecord - the record.public void waitForTermination(long timeoutInMs)
throws java.lang.InterruptedException
IWriterControllerterminateMonitoring().waitForTermination in interface IWriterControllertimeoutInMs - timeout in milliseconds to wait (a timeout of 0 means to wait forever)java.lang.InterruptedException - if the calling thread was interrupted while waiting for the terminationpublic final ScheduledSamplerJob schedulePeriodicSampler(ISampler sampler, long initialDelay, long period, java.util.concurrent.TimeUnit timeUnit)
ISamplingControllerISampler with given initial delay, and period.schedulePeriodicSampler in interface ISamplingControllersampler - The sampler to schedule.initialDelay - The initial delay.period - The period.timeUnit - The time unit which determines how to interpret the given parameter.ScheduledSamplerJob as a handler for removing the scheduled sampler later on by using the method
ISamplingController.removeScheduledSampler(ScheduledSamplerJob).public final boolean removeScheduledSampler(ScheduledSamplerJob sampler)
ISamplingControllerScheduledSamplerJob .removeScheduledSampler in interface ISamplingControllersampler - The sampler to be removed.public final ITimeSource getTimeSource()
ITimeSourceControllergetTimeSource in interface ITimeSourceControllerpublic final java.lang.String getControllerDomain()
getControllerDomain in interface IRemoteControllerpublic final boolean activateProbe(java.lang.String pattern)
IProbeControlleractivateProbe in interface IProbeControllerpattern - pattern for the probepublic final boolean deactivateProbe(java.lang.String pattern)
IProbeControllerdeactivateProbe in interface IProbeControllerpattern - pattern for the probepublic boolean isProbeActivated(java.lang.String signature)
IProbeControllerisProbeActivated in interface IProbeControllersignature - signature of the probepublic void setProbePatternList(java.util.List<java.lang.String> patternList)
IProbeControllersetProbePatternList in interface IProbeControllerpatternList - 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.public java.util.List<java.lang.String> getProbePatternList()
IProbeControllergetProbePatternList in interface IProbeControllerpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllPatternParameters(java.lang.String pattern)
IProbeControllergetAllPatternParameters in interface IProbeControllerpattern - The pattern of the probe.public void deletePatternParameter(java.lang.String pattern,
java.lang.String parameterName)
IProbeControllerdeletePatternParameter in interface IProbeControllerpattern - The parameters to be deleted.parameterName - The name of the parameter.public void clearPatternParameters(java.lang.String pattern)
IProbeControllerclearPatternParameters in interface IProbeControllerpattern - The parameters to be deleted.public void addPatternParameter(java.lang.String pattern,
java.lang.String parameterName,
java.util.List<java.lang.String> parameters)
IProbeControlleraddPatternParameter in interface IProbeControllerpattern - The pattern of the probe.parameterName - The name of the parameter.parameters - a List of entries for this parameter.public void addPatternParameterValue(java.lang.String pattern,
java.lang.String name,
java.lang.String value)
IProbeControlleraddPatternParameterValue in interface IProbeControllerpattern - identifying the pattern for the parametername - name of the parametervalue - value to be added to the list of parameter values.public void removePatternParameterValue(java.lang.String pattern,
java.lang.String name,
java.lang.String value)
IProbeControllerremovePatternParameterValue in interface IProbeControllerpattern - identifying the pattern for the parametername - name of the parametervalue - value to be removed from the list of parameter values.public static final IMonitoringController getInstance()
Copyright 2020 Kieker Project, http://kieker-monitoring.net