You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/01/26 01:05:56 UTC
[incubator-servicecomb-java-chassis] 06/06: resove metrics compile
warnings
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit ef13d51211e02cb427031e0869ac35df4f9d4dc2
Author: wujimin <wu...@huawei.com>
AuthorDate: Wed Jan 24 14:59:12 2018 +0800
resove metrics compile warnings
---
.../servicecomb/metrics/common/CallMetric.java | 4 ++--
.../metrics/core/utils/MonitorUtils.java | 4 ++--
.../servicecomb/samples/mwf/TestWriteFile.java | 25 +++++++++++-----------
3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/metrics/metrics-common/src/main/java/org/apache/servicecomb/metrics/common/CallMetric.java b/metrics/metrics-common/src/main/java/org/apache/servicecomb/metrics/common/CallMetric.java
index 4c5c862..36e1d49 100644
--- a/metrics/metrics-common/src/main/java/org/apache/servicecomb/metrics/common/CallMetric.java
+++ b/metrics/metrics-common/src/main/java/org/apache/servicecomb/metrics/common/CallMetric.java
@@ -81,10 +81,10 @@ public class CallMetric {
public Map<String, Number> toMap() {
Map<String, Number> metrics = new HashMap<>();
- for (MetricValue totalValue : totalValues) {
+ for (LongMetricValue totalValue : totalValues) {
metrics.put(prefix + ".total." + totalValue.getKey(), totalValue.getValue());
}
- for (MetricValue tpsValue : tpsValues) {
+ for (DoubleMetricValue tpsValue : tpsValues) {
metrics.put(prefix + ".tps." + tpsValue.getKey(), tpsValue.getValue());
}
return metrics;
diff --git a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/utils/MonitorUtils.java b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/utils/MonitorUtils.java
index f2a8169..20bfe4e 100644
--- a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/utils/MonitorUtils.java
+++ b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/utils/MonitorUtils.java
@@ -42,12 +42,12 @@ public class MonitorUtils {
return value < 0 ? 0 : value;
}
- public static boolean containsTagValue(Monitor monitor, String tagKey, String tagValue) {
+ public static boolean containsTagValue(Monitor<?> monitor, String tagKey, String tagValue) {
TagList tags = monitor.getConfig().getTags();
return tags.containsKey(tagKey) && tagValue.equals(tags.getTag(tagKey).getValue());
}
- public static Map<String, String> convertTags(Monitor monitor) {
+ public static Map<String, String> convertTags(Monitor<?> monitor) {
TagList tags = monitor.getConfig().getTags();
if (tags.size() != 0) {
Map<String, String> tagMap = new HashMap<>();
diff --git a/samples/metrics-write-file-sample/metrics-write-file/src/test/java/org/apache/servicecomb/samples/mwf/TestWriteFile.java b/samples/metrics-write-file-sample/metrics-write-file/src/test/java/org/apache/servicecomb/samples/mwf/TestWriteFile.java
index 63a46d2..8571ae7 100644
--- a/samples/metrics-write-file-sample/metrics-write-file/src/test/java/org/apache/servicecomb/samples/mwf/TestWriteFile.java
+++ b/samples/metrics-write-file-sample/metrics-write-file/src/test/java/org/apache/servicecomb/samples/mwf/TestWriteFile.java
@@ -17,7 +17,6 @@
package org.apache.servicecomb.samples.mwf;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -138,22 +137,24 @@ public class TestWriteFile {
StringBuilder builder = new StringBuilder();
- MetricsFileWriter writer = (loggerName, filePrefix, content) ->
- builder.append(loggerName).append(filePrefix).append(content);
+ MetricsFileWriter writer =
+ (loggerName, filePrefix, content) -> builder.append(loggerName).append(filePrefix).append(content);
SystemMetric systemMetric = new SystemMetric(50, 10, 1, 2, 3,
4, 5, 6, 7, 8);
Map<String, ConsumerInvocationMetric> consumerInvocationMetricMap = new HashMap<>();
- consumerInvocationMetricMap.put("A", new ConsumerInvocationMetric("A", "A",
- new TimerMetric("A1", 1, 2, 3, 4),
- new CallMetric("A2", Collections.singletonList(new LongMetricValue("A2", 100L, new HashMap<>())),
- Collections.singletonList(new DoubleMetricValue("A2", 999.44444, new HashMap<>())))));
-
- consumerInvocationMetricMap.put("B", new ConsumerInvocationMetric("B", "B",
- new TimerMetric("B1", 1, 2, 3, 4),
- new CallMetric("B2", Collections.singletonList(new LongMetricValue("B2", 100L, new HashMap<>())),
- Collections.singletonList(new DoubleMetricValue("B2", 888.66666, new HashMap<>())))));
+ consumerInvocationMetricMap.put("A",
+ new ConsumerInvocationMetric("A", "A",
+ new TimerMetric("A1", 1, 2, 3, 4),
+ new CallMetric("A2", Collections.singletonList(new LongMetricValue("A2", 100L, new HashMap<>())),
+ Collections.singletonList(new DoubleMetricValue("A2", 999.44444, new HashMap<>())))));
+
+ consumerInvocationMetricMap.put("B",
+ new ConsumerInvocationMetric("B", "B",
+ new TimerMetric("B1", 1, 2, 3, 4),
+ new CallMetric("B2", Collections.singletonList(new LongMetricValue("B2", 100L, new HashMap<>())),
+ Collections.singletonList(new DoubleMetricValue("B2", 888.66666, new HashMap<>())))));
RegistryMetric metric = new RegistryMetric(systemMetric, consumerInvocationMetricMap, new HashMap<>(),
new HashMap<>());
--
To stop receiving notification emails like this one, please contact
liubao@apache.org.