[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400242#comment-16400242
 ] 

ASF GitHub Bot commented on SCB-369:


liubao68 closed pull request #575: [SCB-369] Extract info from spectator 
measurement
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/575
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/foundations/foundation-metrics/pom.xml 
b/foundations/foundation-metrics/pom.xml
index 96bd6f7a1..baa407cb7 100644
--- a/foundations/foundation-metrics/pom.xml
+++ b/foundations/foundation-metrics/pom.xml
@@ -35,6 +35,10 @@
   com.netflix.archaius
   archaius-core
 
+
+  com.netflix.spectator
+  spectator-reg-servo
+
 
   org.slf4j
   slf4j-log4j12
diff --git 
a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/publish/spectator/DefaultTagFinder.java
 
b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/publish/spectator/DefaultTagFinder.java
new file mode 100644
index 0..74601f3b9
--- /dev/null
+++ 
b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/publish/spectator/DefaultTagFinder.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.foundation.metrics.publish.spectator;
+
+import com.netflix.spectator.api.Tag;
+
+public class DefaultTagFinder implements TagFinder {
+  private String tagKey;
+
+  public DefaultTagFinder(String tagKey) {
+this.tagKey = tagKey;
+  }
+
+  @Override
+  public String getTagKey() {
+return tagKey;
+  }
+
+  @Override
+  public Tag find(Iterable tags) {
+for (Tag tag : tags) {
+  if (tag.key().equals(tagKey)) {
+return tag;
+  }
+}
+
+return null;
+  }
+}
diff --git 
a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/publish/spectator/MeasurementGroupConfig.java
 
b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/publish/spectator/MeasurementGroupConfig.java
new file mode 100644
index 0..48075fc8a
--- /dev/null
+++ 
b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/publish/spectator/MeasurementGroupConfig.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.foundation.metrics.publish.spectator;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class MeasurementGroupConfig {
+  // key is measurement id name
+  private Map> groups = new HashMap<>();
+
+  public MeasurementGroupConfig() {
+  }
+
+  public MeasurementGroupConfig(String idName, Object... tagNameOrFinders) {
+addGroup(idName, tagNameOrFinders);
+  }
+
+  public void addGroup(String idName, Object... tagNameOrFinders) {
+groups.put(idName,
+Arrays
+.asList(tagNameOrFinders)
+.stream()
+.map(r -> TagFinder.build(r))
+.collect(Collectors.toList()));
+  }

[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400130#comment-16400130
 ] 

ASF GitHub Bot commented on SCB-369:


coveralls commented on issue #575: [SCB-369] Extract info from spectator 
measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#issuecomment-371080516
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15989381/badge)](https://coveralls.io/builds/15989381)
   
   Coverage increased (+0.08%) to 87.293% when pulling 
**f06a72586a5a215afbee9ae735719d2b8689df0a on 
wujimin:extract-info-from-spectator-measurement** into 
**e54338354e5547c3fbc1e80bc6d0c9cf98bf39b8 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16396529#comment-16396529
 ] 

ASF GitHub Bot commented on SCB-369:


coveralls commented on issue #575: [SCB-369] Extract info from spectator 
measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#issuecomment-371080516
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15942151/badge)](https://coveralls.io/builds/15942151)
   
   Coverage increased (+0.03%) to 87.239% when pulling 
**7ab14486a7107b9be2159aedcf92434d645b98ad on 
wujimin:extract-info-from-spectator-measurement** into 
**0c2e8d55f10e55174427429f58376a06be9cf5b2 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16390927#comment-16390927
 ] 

ASF GitHub Bot commented on SCB-369:


coveralls commented on issue #575: [SCB-369] Extract info from spectator 
measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#issuecomment-371080516
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15870056/badge)](https://coveralls.io/builds/15870056)
   
   Coverage increased (+0.08%) to 87.293% when pulling 
**b133e5c58e5123a02e672137a260f657cfbbf58a on 
wujimin:extract-info-from-spectator-measurement** into 
**83ae473e27889734d8cc0ecf428cd2538d26b1a4 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16390902#comment-16390902
 ] 

ASF GitHub Bot commented on SCB-369:


wujimin commented on a change in pull request #575: [SCB-369] Extract info from 
spectator measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#discussion_r173089137
 
 

 ##
 File path: 
foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementTree.java
 ##
 @@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.foundation.metrics.publish.spectator;
+
+import java.util.concurrent.TimeUnit;
+
+import org.hamcrest.Matchers;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import com.netflix.spectator.api.ManualClock;
+import com.netflix.spectator.api.Registry;
+import com.netflix.spectator.api.Statistic;
+import com.netflix.spectator.api.Timer;
+import com.netflix.spectator.servo.ServoRegistry;
+
+public class TestMeasurementTree {
+  MeasurementTree tree = new MeasurementTree();
+
+  ManualClock clock = new ManualClock();
+
+  Registry registry = new ServoRegistry(clock);
+
+  Timer timer;
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  @Before
+  public void setup() {
+System.setProperty("servo.pollers", "1000");
+timer = registry.timer("id",
+"g1",
+"g1v",
+"g2",
+"g2v",
+"t3",
+"t3v",
+"t4",
+"t4v");
+registry.counter("id_notCare");
+  }
+
+  @Test
+  public void from() {
+timer.record(10, TimeUnit.SECONDS);
+timer.record(2, TimeUnit.SECONDS);
+
+clock.setWallTime(clock.wallTime() + 1000);
+
+MeasurementGroupConfig config = new MeasurementGroupConfig("id", "g1", 
"g2", Statistic.count.key());
+tree.from(registry.iterator(), config);
+
+Assert.assertEquals(1, tree.getChildren().size());
+
+MeasurementNode node = tree.findChild("id", "g1v", "g2v");
+System.out.println(node.getMeasurements());
 
 Review comment:
   already add spectator information to license file


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16390655#comment-16390655
 ] 

ASF GitHub Bot commented on SCB-369:


coveralls commented on issue #575: [SCB-369] Extract info from spectator 
measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#issuecomment-371080516
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15866700/badge)](https://coveralls.io/builds/15866700)
   
   Coverage increased (+0.06%) to 87.27% when pulling 
**562e91601e8fb0104cbba37a5ebe60da11de629d on 
wujimin:extract-info-from-spectator-measurement** into 
**83ae473e27889734d8cc0ecf428cd2538d26b1a4 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16390625#comment-16390625
 ] 

ASF GitHub Bot commented on SCB-369:


wujimin commented on a change in pull request #575: [SCB-369] Extract info from 
spectator measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#discussion_r173049020
 
 

 ##
 File path: 
foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementTree.java
 ##
 @@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.foundation.metrics.publish.spectator;
+
+import java.util.concurrent.TimeUnit;
+
+import org.hamcrest.Matchers;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import com.netflix.spectator.api.ManualClock;
+import com.netflix.spectator.api.Registry;
+import com.netflix.spectator.api.Statistic;
+import com.netflix.spectator.api.Timer;
+import com.netflix.spectator.servo.ServoRegistry;
+
+public class TestMeasurementTree {
+  MeasurementTree tree = new MeasurementTree();
+
+  ManualClock clock = new ManualClock();
+
+  Registry registry = new ServoRegistry(clock);
+
+  Timer timer;
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  @Before
+  public void setup() {
+System.setProperty("servo.pollers", "1000");
+timer = registry.timer("id",
+"g1",
+"g1v",
+"g2",
+"g2v",
+"t3",
+"t3v",
+"t4",
+"t4v");
+registry.counter("id_notCare");
+  }
+
+  @Test
+  public void from() {
+timer.record(10, TimeUnit.SECONDS);
+timer.record(2, TimeUnit.SECONDS);
+
+clock.setWallTime(clock.wallTime() + 1000);
+
+MeasurementGroupConfig config = new MeasurementGroupConfig("id", "g1", 
"g2", Statistic.count.key());
+tree.from(registry.iterator(), config);
+
+Assert.assertEquals(1, tree.getChildren().size());
+
+MeasurementNode node = tree.findChild("id", "g1v", "g2v");
+System.out.println(node.getMeasurements());
 
 Review comment:
   deleted.
   and it seems that no need to modify notice file.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389381#comment-16389381
 ] 

ASF GitHub Bot commented on SCB-369:


wujimin commented on a change in pull request #575: [SCB-369] Extract info from 
spectator measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#discussion_r172802250
 
 

 ##
 File path: 
foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementTree.java
 ##
 @@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.foundation.metrics.publish.spectator;
+
+import java.util.concurrent.TimeUnit;
+
+import org.hamcrest.Matchers;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import com.netflix.spectator.api.ManualClock;
+import com.netflix.spectator.api.Registry;
+import com.netflix.spectator.api.Statistic;
+import com.netflix.spectator.api.Timer;
+import com.netflix.spectator.servo.ServoRegistry;
+
+public class TestMeasurementTree {
+  MeasurementTree tree = new MeasurementTree();
+
+  ManualClock clock = new ManualClock();
+
+  Registry registry = new ServoRegistry(clock);
+
+  Timer timer;
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  @Before
+  public void setup() {
+System.setProperty("servo.pollers", "1000");
+timer = registry.timer("id",
+"g1",
+"g1v",
+"g2",
+"g2v",
+"t3",
+"t3v",
+"t4",
+"t4v");
+registry.counter("id_notCare");
+  }
+
+  @Test
+  public void from() {
+timer.record(10, TimeUnit.SECONDS);
+timer.record(2, TimeUnit.SECONDS);
+
+clock.setWallTime(clock.wallTime() + 1000);
+
+MeasurementGroupConfig config = new MeasurementGroupConfig("id", "g1", 
"g2", Statistic.count.key());
+tree.from(registry.iterator(), config);
+
+Assert.assertEquals(1, tree.getChildren().size());
+
+MeasurementNode node = tree.findChild("id", "g1v", "g2v");
+System.out.println(node.getMeasurements());
 
 Review comment:
   oh, sorry, forget to  delete test code.
   and forget to add notice information, i will fix it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389372#comment-16389372
 ] 

ASF GitHub Bot commented on SCB-369:


WillemJiang commented on a change in pull request #575: [SCB-369] Extract info 
from spectator measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#discussion_r172799117
 
 

 ##
 File path: 
foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementTree.java
 ##
 @@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.foundation.metrics.publish.spectator;
+
+import java.util.concurrent.TimeUnit;
+
+import org.hamcrest.Matchers;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import com.netflix.spectator.api.ManualClock;
+import com.netflix.spectator.api.Registry;
+import com.netflix.spectator.api.Statistic;
+import com.netflix.spectator.api.Timer;
+import com.netflix.spectator.servo.ServoRegistry;
+
+public class TestMeasurementTree {
+  MeasurementTree tree = new MeasurementTree();
+
+  ManualClock clock = new ManualClock();
+
+  Registry registry = new ServoRegistry(clock);
+
+  Timer timer;
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  @Before
+  public void setup() {
+System.setProperty("servo.pollers", "1000");
+timer = registry.timer("id",
+"g1",
+"g1v",
+"g2",
+"g2v",
+"t3",
+"t3v",
+"t4",
+"t4v");
+registry.counter("id_notCare");
+  }
+
+  @Test
+  public void from() {
+timer.record(10, TimeUnit.SECONDS);
+timer.record(2, TimeUnit.SECONDS);
+
+clock.setWallTime(clock.wallTime() + 1000);
+
+MeasurementGroupConfig config = new MeasurementGroupConfig("id", "g1", 
"g2", Statistic.count.key());
+tree.from(registry.iterator(), config);
+
+Assert.assertEquals(1, tree.getChildren().size());
+
+MeasurementNode node = tree.findChild("id", "g1v", "g2v");
+System.out.println(node.getMeasurements());
 
 Review comment:
   Please don't use the System.out.println here.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-369) support extract publish information from spectator measurement

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389318#comment-16389318
 ] 

ASF GitHub Bot commented on SCB-369:


coveralls commented on issue #575: [SCB-369] Extract info from spectator 
measurement
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/575#issuecomment-371080516
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15848370/badge)](https://coveralls.io/builds/15848370)
   
   Coverage increased (+0.06%) to 87.286% when pulling 
**14fb3e024781c339eb386e180ca2496684b0d6ff on 
wujimin:extract-info-from-spectator-measurement** into 
**6f62b75d28fb41d4820de75124acb64e75fb3405 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> support extract publish information from spectator measurement
> --
>
> Key: SCB-369
> URL: https://issues.apache.org/jira/browse/SCB-369
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)