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, terminate
public static final MonitoringController createInstance(Configuration configuration)
configuration
- The configuration for the new controller.public static final java.lang.String getVersion()
public void beforeEnableMonitoring()
IStateListener
beforeEnableMonitoring
in interface IStateListener
protected final void init()
AbstractController
init
in class AbstractController
protected final void cleanup()
AbstractController
cleanup
in class AbstractController
public final java.lang.String toString()
IMonitoringController
toString
in interface IMonitoringController
toString
in class AbstractController
public final boolean sendMetadataAsRecord()
sendMetadataAsRecord
in interface IMonitoringController
protected SamplingController getSamplingController()
public final boolean terminateMonitoring()
IStateController
terminateMonitoring
in interface IStateController
IStateController.isMonitoringTerminated()
public final boolean isMonitoringTerminated()
IStateController
isMonitoringTerminated
in interface IStateController
IStateController.terminateMonitoring()
public final boolean enableMonitoring()
IStateController
enableMonitoring
in interface IStateController
public final boolean disableMonitoring()
IStateController
disableMonitoring
in interface IStateController
public final boolean isMonitoringEnabled()
IStateController
isMonitoringEnabled
in interface IStateController
IStateController.disableMonitoring()
,
IStateController.enableMonitoring()
public final boolean isDebug()
IStateController
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.
isDebug
in interface IStateController
public final java.lang.String getName()
IStateController
getName
in interface IStateController
public final java.lang.String getHostname()
IStateController
getHostname
in interface IStateController
public java.lang.String getApplicationName()
IMonitoringController
getApplicationName
in interface IMonitoringController
public final int incExperimentId()
IStateController
incExperimentId
in interface IStateController
public final void setExperimentId(int newExperimentID)
IStateController
setExperimentId
in interface IStateController
newExperimentID
- The new ID.public final int getExperimentId()
getExperimentId
in interface IStateController
public 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 IMonitoringRecordReceiver
newMonitoringRecord
in interface IWriterController
record
- the record.public void waitForTermination(long timeoutInMs) throws java.lang.InterruptedException
IWriterController
terminateMonitoring()
.waitForTermination
in interface IWriterController
timeoutInMs
- 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)
ISamplingController
ISampler
with given initial delay, and period.schedulePeriodicSampler
in interface ISamplingController
sampler
- 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)
ISamplingController
ScheduledSamplerJob
.removeScheduledSampler
in interface ISamplingController
sampler
- The sampler to be removed.public final ITimeSource getTimeSource()
ITimeSourceController
getTimeSource
in interface ITimeSourceController
public final java.lang.String getControllerDomain()
getControllerDomain
in interface IRemoteController
public final boolean activateProbe(java.lang.String pattern)
IProbeController
activateProbe
in interface IProbeController
pattern
- pattern for the probepublic final boolean deactivateProbe(java.lang.String pattern)
IProbeController
deactivateProbe
in interface IProbeController
pattern
- pattern for the probepublic boolean isProbeActivated(java.lang.String signature)
IProbeController
isProbeActivated
in interface IProbeController
signature
- signature of the probepublic void setProbePatternList(java.util.List<java.lang.String> patternList)
IProbeController
setProbePatternList
in interface IProbeController
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.public java.util.List<java.lang.String> getProbePatternList()
IProbeController
getProbePatternList
in interface IProbeController
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllPatternParameters(java.lang.String pattern)
IProbeController
getAllPatternParameters
in interface IProbeController
pattern
- The pattern of the probe.public void deletePatternParameter(java.lang.String pattern, java.lang.String parameterName)
IProbeController
deletePatternParameter
in interface IProbeController
pattern
- The parameters to be deleted.parameterName
- The name of the parameter.public void clearPatternParameters(java.lang.String pattern)
IProbeController
clearPatternParameters
in interface IProbeController
pattern
- The parameters to be deleted.public void addPatternParameter(java.lang.String pattern, java.lang.String parameterName, java.util.List<java.lang.String> parameters)
IProbeController
addPatternParameter
in interface IProbeController
pattern
- 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)
IProbeController
addPatternParameterValue
in interface IProbeController
pattern
- 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)
IProbeController
removePatternParameterValue
in interface IProbeController
pattern
- 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