本文整理汇总了Java中com.singularity.ee.agent.systemagent.api.MetricWriter.printMetric方法的典型用法代码示例。如果您正苦于以下问题:Java MetricWriter.printMetric方法的具体用法?Java MetricWriter.printMetric怎么用?Java MetricWriter.printMetric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.singularity.ee.agent.systemagent.api.MetricWriter
的用法示例。
在下文中一共展示了MetricWriter.printMetric方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
/**
* @param metrics
*/
private void printMetric(Map<String, Number> metrics) {
for (Map.Entry<String, Number> metric : metrics.entrySet()) {
MetricWriter metricWriter = super.getMetricWriter(metric.getKey(), MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE, MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE, MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_COLLECTIVE
);
Object metricValue = metric.getValue();
if (metricValue instanceof BigDecimal) {
metricWriter.printMetric(String.valueOf(((BigDecimal) metricValue).longValue()));
} else if (metricValue instanceof Double) {
metricWriter.printMetric(String.valueOf(Math.round((Double) metricValue)));
} else if (metricValue instanceof Float) {
metricWriter.printMetric(String.valueOf(Math.round((Float) metricValue)));
} else {
metricWriter.printMetric(String.valueOf(metricValue));
}
}
}
示例2: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
/**
* Returns the metric to the AppDynamics Controller.
*
* @param metricName Name of the Metric
* @param metricValue Value of the Metric
*/
public void printMetric(String metricName, Number metricValue) {
if (metricValue != null) {
if(metricName.contains(",")) {
metricName = metricName.replaceAll(",", ":");
}
try {
MetricWriter metricWriter = getMetricWriter(metricName,
MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE,
MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE,
MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL
);
metricWriter.printMetric(MetricUtils.toWholeNumberString(metricValue));
} catch (Exception e) {
logger.error("Exception while reporting metric " + metricName + " : " + metricValue, e);
}
} else {
logger.warn("Metric " + metricName + " is null");
}
}
示例3: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
private void printMetric(String metricPath, Number metricValue, String aggregation, String timeRollup, String cluster) {
MetricWriter metricWriter = super.getMetricWriter(metricPath, aggregation, timeRollup, cluster);
if (metricValue != null) {
if (logger.isDebugEnabled()) {
logger.debug("Metric [" + metricPath + " = " + metricValue + "]");
}
if (metricValue instanceof Double) {
metricWriter.printMetric(String.valueOf(Math.round((Double) metricValue)));
} else if (metricValue instanceof Float) {
metricWriter.printMetric(String.valueOf(Math.round((Float) metricValue)));
} else {
metricWriter.printMetric(String.valueOf(metricValue));
}
}
}
示例4: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
private void printMetric(String metricPath, String metricName, Object metricValue) {
if (metricValue != null) {
MetricWriter metricWriter = super.getMetricWriter(getMetricPrefix() + metricPath + metricName,
MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE, MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE,
MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_COLLECTIVE);
metricWriter.printMetric(String.valueOf(metricValue));
}
}
示例5: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
private void printMetric(String metricPrefix, String metricPath, Object metricValue) {
MetricWriter metricWriter = super.getMetricWriter(metricPrefix + metricPath, MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE, MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE, MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_COLLECTIVE
);
if (metricValue instanceof Double) {
metricWriter.printMetric(String.valueOf(Math.round((Double) metricValue)));
} else if (metricValue instanceof Float) {
metricWriter.printMetric(String.valueOf(Math.round((Float) metricValue)));
} else {
metricWriter.printMetric(String.valueOf(metricValue));
}
}
示例6: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
private void printMetric(String metricPath, String metricValue, String aggregation, String timeRollup, String cluster) {
MetricWriter metricWriter = super.getMetricWriter(metricPath, aggregation, timeRollup, cluster);
if (metricValue != null) {
if (logger.isDebugEnabled()) {
logger.debug("Metric [" + metricPath + " = " + metricValue + "]");
}
metricWriter.printMetric(metricValue);
}
}
示例7: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
/**
* Returns the metric to the AppDynamics Controller.
*
* @param metricName Name of the Metric
* @param metricValue Value of the Metric
* @param aggregation Average OR Observation OR Sum
* @param timeRollup Average OR Current OR Sum
* @param cluster Collective OR Individual
*/
public void printMetric(
final String metricName,
final Object metricValue,
final String aggregation,
final String timeRollup,
final String cluster) {
final MetricWriter metricWriter = getMetricWriter(
getMetricPrefix() + metricName, aggregation, timeRollup, cluster);
metricWriter.printMetric(String.valueOf(metricValue));
}
示例8: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
/**
* Returns the metric to the AppDynamics Controller.
* @param metricName Name of the Metric
* @param metricValue Value of the Metric
* @param aggregation Average OR Observation OR Sum
* @param timeRollup Average OR Current OR Sum
* @param cluster Collective OR Individual
*/
private void printMetric(String metricName, Number metricValue, String aggregation, String timeRollup, String cluster) throws Exception
{
MetricWriter metricWriter = super.getMetricWriter(METRIC_PREFIX + metricName,
aggregation,
timeRollup,
cluster
);
metricWriter.printMetric(String.valueOf((long) metricValue.doubleValue()));
}
示例9: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
/**
* Returns the metric to the AppDynamics Controller.
*
* @param metricName Name of the Metric
* @param metricValue Value of the Metric
* @param aggregation Average OR Observation OR Sum
* @param timeRollup Average OR Current OR Sum
* @param cluster Collective OR Individual
*/
private void printMetric(String metricName, Long metricValue, String aggregation, String timeRollup, String cluster) {
MetricWriter metricWriter = monitor.getMetricWriter(metricName,
aggregation,
timeRollup,
cluster
);
metricWriter.printMetric(String.valueOf(metricValue));
if (logger.isDebugEnabled()) {
logger.debug(String.format("Sending metric = %s = %s", metricName, metricValue));
}
}
示例10: printAllMetrics
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
/**
* Returns the metric to the AppDynamics Controller.
* @param metricValue Value of the Metric
*/
private void printAllMetrics()
{
for(String key : metrics.keySet())
{
MetricWriter metricWriter = getMetricWriter(metricPath + key,
MetricWriter.METRIC_AGGREGATION_TYPE_OBSERVATION,
MetricWriter.METRIC_TIME_ROLLUP_TYPE_CURRENT,
MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_COLLECTIVE);
metricWriter.printMetric(String.valueOf(metrics.get(key)));
}
}
示例11: printMetric
import com.singularity.ee.agent.systemagent.api.MetricWriter; //导入方法依赖的package包/类
protected void printMetric(String metricName, String value) {
if(!Strings.isNullOrEmpty(value)) {
try {
MetricWriter metricWriter = getMetricWriter(metricName, MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE, MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE,
MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL);
metricWriter.printMetric(value);
//System.out.println(metricName + " " + value);
if (logger.isDebugEnabled()) {
logger.debug("METRIC: NAME:" + metricName + " VALUE:" + value);
}
} catch (Exception e) {
logger.error(e);
}
}
}