You are here: Custom Metrics APIs
Custom Metrics APIs for Volt MX Server
This section contains Javadoc information about classes. Classes define the API required for sending custom metrics from Volt MX Server. These classes are as follows:
- com.hcl.voltmx.middleware.metrics.VoltMXCustomMetricsDataSet
- com.hcl.voltmx.middleware.metrics.VoltMXCustomMetrics
- MetricsException
com.hcl.voltmx.middleware.metrics.VoltMXCustomMetricsDataSet
The com.hcl.voltmx.middleware.metrics.VoltMXCustomMetricsDataSet class contains methods required for setting custom metrics. To enable custom metrics from server, the following methods are available.
- setMetricsString
- setMetricsBoolean
- setMetricsLong
- setMetricsDouble
- setMetricsDate
- setMetricsTimestamp
- getMetricsMap
- get
- remove
- toString
setMetricsString
This method is used to set custom metrics for the data type, string.
Signature
public void setMetricsStrting(String key,String value)
throws MetricsException
Input Parameters
key
value
Return Values
Void
Can throw metricsException.
Java Example
metricsDataset.setMetricsString("Product Name", "Dell Vostro");
setMetricsBoolean
This method is used to set custom metric for the data type, boolean. This method takes either true or false as values.
Signature
public void setMetricsBoolean(String key,boolean value)
Input Parameters
key
value
Return Values
Void
Java Example
metricsDataset.setMetricsBoolean("On Sale", true);
setMetricsLong
This method is used to set custom metric for the data type, long.
Signature
public void setMetricsLong(String key,long value)
Input Parameters
key
value
Return Values
Void
Java Example
metricsDataset.setMetricsLong("Product ID", 395923);
setMetricsDouble
This method is used to set custom metric for the data type, double.
Signature
public void setMetricsDouble(String key,double value)
Input Parameters:
key
value
Return Values
Void
Java Example
metricsDataset.setMetricsDouble("Product Price", 399.90);
setMetricsDate
This method is used to set custom metric for the data type, date. It takes Date Object as input. The Data Object format should be yyyy-MM-dd'.
Signature
public void setMetricsDate(String key,Date date)
throws MetricsException
Input Parameters:
key - String
value - Date
Return Values
Void
Can throw metricsException.
Java Example
metricsDataset.setMetricsDate("On Sale Date", "2012-10-20");
setMetricsDate
This method is used to set custom metric for the data type, date. The input takes date value as a string and the date value format should be yyyy-MM-dd.
Signature
public void setMetricsDate(String key,String val)
throws MetricsException
Input Parameters
key - String
value - String, Date value in string
Return Values
Void.
Can throw metricsException.
Java Example
metricsDataset.setMetricsDate("On Sale Date", "2012-10-20");
setMetricsDate
This method is used for setting custom metric for the data type, date. This method takes date and format as a string and evaluates the date value with the given format. Input takes date value as a string and the date value format should be yyyy-MM-dd.