本文整理汇总了Java中com.appdynamics.extensions.util.MetricWriteHelper.printMetric方法的典型用法代码示例。如果您正苦于以下问题:Java MetricWriteHelper.printMetric方法的具体用法?Java MetricWriteHelper.printMetric怎么用?Java MetricWriteHelper.printMetric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.appdynamics.extensions.util.MetricWriteHelper
的用法示例。
在下文中一共展示了MetricWriteHelper.printMetric方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printMetric
import com.appdynamics.extensions.util.MetricWriteHelper; //导入方法依赖的package包/类
/**
* Returns the metric to the AppDynamics Controller.
*
* @param metricPrefix Metric prefix
* @param metricName Name of the Metric
* @param metricValue Value of the Metric
*/
private void printMetric(String metricPrefix, String metricName, Object metricValue) {
String aggregation = MetricWriter.METRIC_AGGREGATION_TYPE_OBSERVATION;
String timeRollup = MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE;
String cluster = MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_COLLECTIVE;
String serverName = (String) server.get("name");
String metricPath = metricPrefix + METRIC_SEPARATOR + serverName + METRIC_SEPARATOR + metricName;
MetricWriteHelper metricWriter = configuration.getMetricWriter();
metricWriter.printMetric(metricPath, metricValue.toString(), aggregation, timeRollup, cluster);
if (logger.isDebugEnabled()) {
logger.debug("Metric [" + aggregation + "/" + timeRollup + "/" + cluster
+ "] metric = " + metricPath + " = " + metricValue);
}
}
示例2: printMetrics
import com.appdynamics.extensions.util.MetricWriteHelper; //导入方法依赖的package包/类
private void printMetrics(Map<String, BigDecimal> solrMetrics) {
MetricWriteHelper metricWriter = configuration.getMetricWriter();
String metricPrefix = configuration.getMetricPrefix();
String aggregation = MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE;
String cluster = MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL;
String timeRollup = MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE;
for (Map.Entry<String, BigDecimal> entry : solrMetrics.entrySet()) {
String metricPath = metricPrefix + "|" + server.get("name").toString() + entry.getKey();
String metricValue = String.valueOf(entry.getValue());
metricWriter.printMetric(metricPath, metricValue, aggregation, timeRollup, cluster);
}
}