public class MetricsManager extends Object
Constructor and Description |
---|
MetricsManager() |
Modifier and Type | Method and Description |
---|---|
Collection<ControlledMetric<?,?>> |
getMetrics() |
Map<ControlledMetric<?,?>,MetricValueDetails> |
getMetricValueDetailsMap()
Return a map of the controlled metrics and their current associated values.
|
String[] |
getMetricValues() |
Map<ControlledMetric<?,?>,Number> |
getMetricValuesMap()
Return a map of the controlled metrics and their current associated values.
|
int |
getPersistCount() |
void |
persist()
Persists the configured metrics by calling to the registered updaters, extracting the value-details from the
metrics, and then calling the registered value and details persisters.
|
String |
persistJmx() |
void |
persistValuesOnly()
Persists the configured metrics to the value persisters only by extracting the values from the metrics and
then calling the registered persisters.
|
void |
registerMetric(ControlledMetric<?,?> metric)
Register a metric with the manager.
|
void |
registerUpdater(MetricsUpdater metricsUpdater)
Register a
MetricsUpdater to be called right before persist writes the metrics. |
void |
setJmxServer(com.j256.simplejmx.server.JmxServer jmxServer)
Set the optional jmx-server that can be used to publish metrics to JMX.
|
void |
setMetricDetailsPersisters(MetricDetailsPersister[] metricDetailsPersisters)
Set the persisters for the metric details.
|
void |
setMetricValuesPersisters(MetricValuesPersister[] metricValuesPersisters)
Set the persisters for the metric values.
|
void |
unregisterMetric(ControlledMetric<?,?> metric)
Unregister a metric with the manager.
|
void |
updateMetrics()
Update the various classes' metrics.
|
public void registerMetric(ControlledMetric<?,?> metric)
public void unregisterMetric(ControlledMetric<?,?> metric)
public void registerUpdater(MetricsUpdater metricsUpdater)
MetricsUpdater
to be called right before persist writes the metrics.public void persist() throws IOException
IOException
public void persistValuesOnly() throws IOException
persist()
instead.
NOTE: you should call updateMetrics() before calling this method if necessary.
IOException
public Map<ControlledMetric<?,?>,Number> getMetricValuesMap()
updateMetrics()
beforehand.public Map<ControlledMetric<?,?>,MetricValueDetails> getMetricValueDetailsMap()
updateMetrics()
beforehand.public void updateMetrics()
public String persistJmx()
public Collection<ControlledMetric<?,?>> getMetrics()
public void setJmxServer(com.j256.simplejmx.server.JmxServer jmxServer)
public void setMetricValuesPersisters(MetricValuesPersister[] metricValuesPersisters)
public void setMetricDetailsPersisters(MetricDetailsPersister[] metricDetailsPersisters)
public String[] getMetricValues()
public int getPersistCount()
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.