Class FileMetricsPublisher
java.lang.Object
com.j256.simplemetrics.utils.FileMetricsPublisher
- All Implemented Interfaces:
MetricsUpdater
Exposes metrics that can be found from files on file-system. This is often used to read from the /proc file-system
under Linux. Metrics are configured with the
FileMetric class. A common file metric is the number of open
file-descriptors being used by the JVM.
NOTE: If you are using the no-arg constructor (like with Spring) you will need to make sure that
initialize() is called.
- Author:
- graywatson
-
Constructor Summary
ConstructorsConstructorDescriptionFileMetricsPublisher(MetricsManager metricsManager, List<FileMetric> fileMetrics) Constructs our publisher and callsinitialize(). -
Method Summary
Modifier and TypeMethodDescriptionlongNumber of times we were unable to update a metric because of some i/o or parse problem.String[]Get the values for all of the metric managed by this class.voidShould be called if the no-arg construct is being used and after the various setters have been called.voidsetFileMetrics(FileMetric[] fileMetrics) Sets the file metrics that we are publishing.voidsetMetricsManager(MetricsManager metricsManager) Metrics manager that we add our metrics to.voidCalled byMetricsManagerright before it is to persist the metrics.
-
Constructor Details
-
FileMetricsPublisher
public FileMetricsPublisher() -
FileMetricsPublisher
Constructs our publisher and callsinitialize().
-
-
Method Details
-
initialize
public void initialize()Should be called if the no-arg construct is being used and after the various setters have been called. Maybe by Springs init mechanism? -
setMetricsManager
Metrics manager that we add our metrics to. -
setFileMetrics
Sets the file metrics that we are publishing. -
updateMetrics
public void updateMetrics()Description copied from interface:MetricsUpdaterCalled byMetricsManagerright before it is to persist the metrics.- Specified by:
updateMetricsin interfaceMetricsUpdater
-
getFailedUpdateCount
public long getFailedUpdateCount()Number of times we were unable to update a metric because of some i/o or parse problem. -
getMetricsValues
Get the values for all of the metric managed by this class.
-