Java Code Examples for org.apache.hadoop.metrics2.AbstractMetric#value()
The following examples show how to use
org.apache.hadoop.metrics2.AbstractMetric#value() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AzureBlobStorageTestAccount.java From hadoop with Apache License 2.0 | 6 votes |
public Number getLatestMetricValue(String metricName, Number defaultValue) throws IndexOutOfBoundsException{ boolean found = false; Number ret = null; for (MetricsRecord currentRecord : allMetrics) { // First check if this record is coming for my file system. if (wasGeneratedByMe(currentRecord)) { for (AbstractMetric currentMetric : currentRecord.metrics()) { if (currentMetric.name().equalsIgnoreCase(metricName)) { found = true; ret = currentMetric.value(); break; } } } } if (!found) { if (defaultValue != null) { return defaultValue; } throw new IndexOutOfBoundsException(metricName); } return ret; }
Example 2
Source File: AzureBlobStorageTestAccount.java From big-c with Apache License 2.0 | 6 votes |
public Number getLatestMetricValue(String metricName, Number defaultValue) throws IndexOutOfBoundsException{ boolean found = false; Number ret = null; for (MetricsRecord currentRecord : allMetrics) { // First check if this record is coming for my file system. if (wasGeneratedByMe(currentRecord)) { for (AbstractMetric currentMetric : currentRecord.metrics()) { if (currentMetric.name().equalsIgnoreCase(metricName)) { found = true; ret = currentMetric.value(); break; } } } } if (!found) { if (defaultValue != null) { return defaultValue; } throw new IndexOutOfBoundsException(metricName); } return ret; }
Example 3
Source File: MetricsCache.java From hadoop with Apache License 2.0 | 2 votes |
/** * Lookup a metric value * @param key name of the metric * @return the metric value */ public Number getMetric(String key) { AbstractMetric metric = metrics.get(key); return metric != null ? metric.value() : null; }
Example 4
Source File: MetricsCache.java From big-c with Apache License 2.0 | 2 votes |
/** * Lookup a metric value * @param key name of the metric * @return the metric value */ public Number getMetric(String key) { AbstractMetric metric = metrics.get(key); return metric != null ? metric.value() : null; }