[GitHub] liubao68 commented on issue #1103: 【求助】使用Edge Service在zipkin无法显示依赖关系。

2019-02-21 Thread GitBox
liubao68 commented on issue #1103: 【求助】使用Edge Service在zipkin无法显示依赖关系。  
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1103#issuecomment-466303578
 
 
   你是使用了handler-tracing对接zipkin吗? 这个是在handler执行的。 edge service只执行consumer 
handler chain,没有provider chain,可能存在你说的情况。如果是这种场景的话, 我们需要验证下,看是否能够优化。


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


With regards,
Apache Git Services


[GitHub] myVictor commented on issue #1103: 【求助】使用Edge Service在zipkin无法显示依赖关系。

2019-02-21 Thread GitBox
myVictor commented on issue #1103: 【求助】使用Edge Service在zipkin无法显示依赖关系。  
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1103#issuecomment-466293562
 
 
   
![image](https://user-images.githubusercontent.com/7285684/53224985-84678980-36b1-11e9-817f-4e94b0530704.png)
   用zuul做就能显示。


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


With regards,
Apache Git Services


[GitHub] myVictor commented on issue #157: Zipkin web page have no tracing information at all

2019-02-21 Thread GitBox
myVictor commented on issue #157: Zipkin web page have no tracing information 
at all
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/157#issuecomment-466293287
 
 
   > 补充一下:
   > **1. webapp,calculator ,servicecenter,zipkin都在容器中运行。组网方式都是bridge. 
云主机地址是:192.168.100.101**
   > 
   > **2. 容器中的webapp和 calculator连接容器中的servicecenter(端口30100)是成功的。**
   > 
   > **3. webapp,calculator的容器启动参数分别为:**
   > 
   > ENTRYPOINT java -jar bmi-webapp-tracing.jar -Ptracing 
-Dservicecomb.tracing.collector.address=http://192.168.100.101:9411
   > 
   > ENTRYPOINT java -jar bmi-calculator-tracing.jar -Ptracing 
-Dcse.handler.chain.Provider.default=tracing-provider 
-Dservicecomb.tracing.collector.address=http://192.168.100.101:9411
   > 
   > **4. 访问报错信息:**
   > 
   > 2017/9/23 下午5:48:262017-09-23 09:48:26,378 [INFO] watching microservice 
6be7a0f09de911e7959a02efcacc0484 successfully, the chosen service center 
address is 192.168.100.101:30100 
io.servicecomb.serviceregistry.client.http.ServiceRegistryClientImpl.lambda$watch$6(ServiceRegistryClientImpl.java:520)
   > 2017/9/23 下午5:48:562017-09-23 09:48:56,262 [WARN] sc task interval changed 
from -1 to 30 
io.servicecomb.serviceregistry.task.ServiceCenterTaskMonitor.beginCycle(ServiceCenterTaskMonitor.java:38)
   > 2017/9/23 下午5:50:202017-09-23 09:50:20,301 [WARN] Dropped 1 spans due to 
ConnectException(Failed to connect to /127.0.0.1:9411) 
zipkin.reporter.AsyncReporter$BoundedAsyncReporter$1.onError(AsyncReporter.java:266)
   > 2017/9/23 下午5:50:20java.net.ConnectException: Failed to connect to 
/127.0.0.1:9411
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:189)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:173)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114) 
~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 
~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 
~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
 ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 
~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.RealCall.access$100(RealCall.java:33) ~[okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) [okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) [okhttp-3.4.1.jar!/:?]
   > 2017/9/23 下午5:50:20at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[?:1.8.0_144]
   > 2017/9/23 下午5:50:20at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[?:1.8.0_144]
   > 2017/9/23 下午5:50:20at java.lang.Thread.run(Thread.java:748) 
[?:1.8.0_144]
   
   我也用这个例子自己实现了一个Edge 
Service(按照用户手册做的),问题是能查找服务信息,但是关系图无法生成出来,是什么原因?用的是URLMappedEdgeDispatcher


[GitHub] coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's dependence on zuul

2019-02-21 Thread GitBox
coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's 
dependence on zuul
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1098#issuecomment-465496709
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/21761471/badge)](https://coveralls.io/builds/21761471)
   
   Coverage decreased (-0.01%) to 85.445% when pulling 
**97bad14fdbe7a73566af501bdcf52bdb747fef9d on yangshaoqin1:SCB-1157** into 
**956ff0e21a2084ea615ce1cccd26249dbb193bf0 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


With regards,
Apache Git Services


[GitHub] coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's dependence on zuul

2019-02-21 Thread GitBox
coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's 
dependence on zuul
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1098#issuecomment-465496709
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/21761196/badge)](https://coveralls.io/builds/21761196)
   
   Coverage decreased (-0.009%) to 85.448% when pulling 
**97bad14fdbe7a73566af501bdcf52bdb747fef9d on yangshaoqin1:SCB-1157** into 
**956ff0e21a2084ea615ce1cccd26249dbb193bf0 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


With regards,
Apache Git Services


[GitHub] myVictor opened a new issue #1103: 【求助】使用Edge Service在zipkin无法显示依赖关系。

2019-02-21 Thread GitBox
myVictor opened a new issue #1103: 【求助】使用Edge Service在zipkin无法显示依赖关系。  
URL: https://github.com/apache/servicecomb-java-chassis/issues/1103
 
 
   按照用户使用手册“使用Edge 
Service做边缘服务”做了一个边缘服务器,方式为URLMappedEdgeDispatcher,路由功能是正常的,但是在Zipkin监控页面无法显示依赖关系。
   
![image](https://user-images.githubusercontent.com/7285684/53221933-9859be00-36a6-11e9-89ee-c71841bbb591.png)
   服务是正常显示的。
   
![image](https://user-images.githubusercontent.com/7285684/53221944-a576ad00-36a6-11e9-8ca1-02963438dbe0.png)
   依赖关系无法显示,这是什么原因?


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


With regards,
Apache Git Services


[GitHub] yangshaoqin1 opened a new pull request #1102: change name of spring cloud starter in serviceComb

2019-02-21 Thread GitBox
yangshaoqin1 opened a new pull request #1102: change name of spring cloud 
starter in serviceComb
URL: https://github.com/apache/servicecomb-java-chassis/pull/1102
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   


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


With regards,
Apache Git Services


[GitHub] wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259182161
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,171 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StatisticsBucket.class);
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY, 
rootId);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(latencyInterval.getId(),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property, Id rootId) {
+List results = new ArrayList<>();
+try {
+  int[] arrays = Arrays.stream(property.trim().split(","))
+  .mapToInt(Integer::parseInt)
+  .distinct()
+  .sorted()
+  .filter(num -> num > 0)
+  .toArray();
+  if (arrays == null || arrays.length == 0) {
+return results;
+  }
+  results.add(new LatencyInterval(0L, arrays[0] * 
TimeUnit.MILLISECONDS.toNanos(1), rootId));
+  for (int i = 1; i < arrays.length; i++) {
+results.add(new LatencyInterval(arrays[i - 1] * 
TimeUnit.MILLISECONDS.toNanos(1),
+arrays[i] * TimeUnit.MILLISECONDS.toNanos(1), rootId));
+  }
+  results.add(
+  new LatencyInterval(arrays[arrays.length - 1] * 
TimeUnit.MILLISECONDS.toNanos(1), Long.MAX_VALUE, rootId));
+} catch (Throwable e) {
+  LOGGER.error("Failed to parse property 
servicecomb.metrics.invocation.latency.buckets", e);
+}
+return results;
+  }
+
+  public static class LatencyInterval {
+
+private static final int leastLength = 7;
+
+private Id id;
+
+private LongAdder times = new LongAdder();
+
+private long lastUpdated = 0L;
+
+private long minValue;
+
+private long maxValue;
+
+public LatencyInterval(long minValue, long maxValue, Id rootId) {
+  this.minValue = minValue;
+  this.maxValue = maxValue;
+  if (rootId != null) {
+this.id = rootId.withTag("bucket", this.getStandardLatencyStr());
+  }
+}
+
+public boolean match(long num) {
+  return minValue <= num && maxValue > num;
+}
+
+public void increment() {
+  this.times.increment();
+}
+
+public long getAndUpdateLastTimes() {
+  long 

[GitHub] wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259181981
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,171 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StatisticsBucket.class);
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY, 
rootId);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(latencyInterval.getId(),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property, Id rootId) {
+List results = new ArrayList<>();
+try {
+  int[] arrays = Arrays.stream(property.trim().split(","))
+  .mapToInt(Integer::parseInt)
+  .distinct()
+  .sorted()
+  .filter(num -> num > 0)
+  .toArray();
+  if (arrays == null || arrays.length == 0) {
+return results;
+  }
+  results.add(new LatencyInterval(0L, arrays[0] * 
TimeUnit.MILLISECONDS.toNanos(1), rootId));
 
 Review comment:
   TimeUnit.MILLISECONDS.toNanos(arrays[0])


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


With regards,
Apache Git Services


[GitHub] wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259181917
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,171 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StatisticsBucket.class);
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
 
 Review comment:
   why need both id and rootId?


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


With regards,
Apache Git Services


[GitHub] wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259181842
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,171 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StatisticsBucket.class);
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY, 
rootId);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(latencyInterval.getId(),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property, Id rootId) {
+List results = new ArrayList<>();
+try {
+  int[] arrays = Arrays.stream(property.trim().split(","))
+  .mapToInt(Integer::parseInt)
+  .distinct()
+  .sorted()
+  .filter(num -> num > 0)
+  .toArray();
+  if (arrays == null || arrays.length == 0) {
+return results;
+  }
+  results.add(new LatencyInterval(0L, arrays[0] * 
TimeUnit.MILLISECONDS.toNanos(1), rootId));
+  for (int i = 1; i < arrays.length; i++) {
+results.add(new LatencyInterval(arrays[i - 1] * 
TimeUnit.MILLISECONDS.toNanos(1),
+arrays[i] * TimeUnit.MILLISECONDS.toNanos(1), rootId));
+  }
+  results.add(
+  new LatencyInterval(arrays[arrays.length - 1] * 
TimeUnit.MILLISECONDS.toNanos(1), Long.MAX_VALUE, rootId));
+} catch (Throwable e) {
+  LOGGER.error("Failed to parse property 
servicecomb.metrics.invocation.latency.buckets", e);
+}
+return results;
+  }
+
+  public static class LatencyInterval {
+
+private static final int leastLength = 7;
+
+private Id id;
+
+private LongAdder times = new LongAdder();
+
+private long lastUpdated = 0L;
+
+private long minValue;
+
+private long maxValue;
+
+public LatencyInterval(long minValue, long maxValue, Id rootId) {
+  this.minValue = minValue;
+  this.maxValue = maxValue;
+  if (rootId != null) {
 
 Review comment:
   when will rootId be null?


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 

[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259180427
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,155 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  public static final long MS_UNIT = 1000_000L;
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY);
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(rootId.withTag("buckets_interval", 
latencyInterval.toString()),
 
 Review comment:
   maybe **buckets_interval** or **buckets_latency** is better ?


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


With regards,
Apache Git Services


[GitHub] wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r258760740
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,171 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StatisticsBucket.class);
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY, 
rootId);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(latencyInterval.getId(),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property, Id rootId) {
+List results = new ArrayList<>();
+try {
+  int[] arrays = Arrays.stream(property.trim().split(","))
+  .mapToInt(Integer::parseInt)
+  .distinct()
+  .sorted()
+  .filter(num -> num > 0)
+  .toArray();
+  if (arrays == null || arrays.length == 0) {
+return results;
+  }
+  results.add(new LatencyInterval(0L, arrays[0] * 
TimeUnit.MILLISECONDS.toNanos(1), rootId));
+  for (int i = 1; i < arrays.length; i++) {
+results.add(new LatencyInterval(arrays[i - 1] * 
TimeUnit.MILLISECONDS.toNanos(1),
+arrays[i] * TimeUnit.MILLISECONDS.toNanos(1), rootId));
+  }
+  results.add(
+  new LatencyInterval(arrays[arrays.length - 1] * 
TimeUnit.MILLISECONDS.toNanos(1), Long.MAX_VALUE, rootId));
+} catch (Throwable e) {
+  LOGGER.error("Failed to parse property 
servicecomb.metrics.invocation.latency.buckets", e);
+}
+return results;
+  }
+
+  public static class LatencyInterval {
 
 Review comment:
   LatencyScope?
   and comment that: [min, max)


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


With regards,
Apache Git Services


[GitHub] wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
wujimin commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r258760605
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,171 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.LongAdder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
 
 Review comment:
   name is strange, seems can not express logic of this class?


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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259172255
 
 

 ##
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/PublishUtils.java
 ##
 @@ -33,7 +34,12 @@ private PublishUtils() {
 
   public static PerfInfo createPerfInfo(MeasurementNode stageNode) {
 PerfInfo perfInfo = new PerfInfo();
-
+MeasurementNode timeInterval = 
stageNode.findChild(StatisticsBucket.TIME_INTERVAL);
+// latency buckets
+if (timeInterval != null) {
+  perfInfo.initInterval(timeInterval);
 
 Review comment:
   Yes. I move it to the class **OperationPerf**, as I thought that every 
operation has it's own latency 
   ```java
   public class OperationPerf {
 private String operation;
   
 private Map stages = new HashMap<>();
   
 private Map buckets = new HashMap<>();
   ```


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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259172255
 
 

 ##
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/PublishUtils.java
 ##
 @@ -33,7 +34,12 @@ private PublishUtils() {
 
   public static PerfInfo createPerfInfo(MeasurementNode stageNode) {
 PerfInfo perfInfo = new PerfInfo();
-
+MeasurementNode timeInterval = 
stageNode.findChild(StatisticsBucket.TIME_INTERVAL);
+// latency buckets
+if (timeInterval != null) {
+  perfInfo.initInterval(timeInterval);
 
 Review comment:
   Yes. I move it to the class **OperationPerf**, as I thought that every 
operation have it's own latency 
   ```java
   public class OperationPerf {
 private String operation;
   
 private Map stages = new HashMap<>();
   
 private Map buckets = new HashMap<>();
   ```


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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259171917
 
 

 ##
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/DefaultLogPublisher.java
 ##
 @@ -89,7 +95,9 @@ public void init(GlobalRegistry globalRegistry, EventBus 
eventBus, MetricsBootst
 .get()) {
   return;
 }
-
+latencyIntervals = StatisticsBucket
 
 Review comment:
   ... maybe it's doesn't matter ? Must I leave the spaces 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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259171917
 
 

 ##
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/DefaultLogPublisher.java
 ##
 @@ -89,7 +95,9 @@ public void init(GlobalRegistry globalRegistry, EventBus 
eventBus, MetricsBootst
 .get()) {
   return;
 }
-
+latencyIntervals = StatisticsBucket
 
 Review comment:
   ... maybe it's doesn't matter ? Must I leave spaces 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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259171434
 
 

 ##
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/DefaultLogPublisher.java
 ##
 @@ -60,27 +62,31 @@
 
   //sample
   private static final String SIMPLE_HEADER = "%s:\n  simple:\n"
-  + "status  tps  latency operation\n";
+  + "status  tpslatency%soperation\n";
 
 Review comment:
   done. 


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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259171235
 
 

 ##
 File path: 
metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/AbstractInvocationMeter.java
 ##
 @@ -43,18 +44,26 @@
   // handler response
   private SimpleTimer handlersResponseTimer;
 
+  // bucket total
+  private StatisticsBucket totalBucket;
+
   private long lastUpdated;
 
   public AbstractInvocationMeter(Registry registry, Id id) {
 this.registry = registry;
 this.id = id;
 
+totalBucket = creatStageBucket(MeterInvocationConst.TOTAL_BUCKETS);
 totalTimer = creatStageTimer(MeterInvocationConst.STAGE_TOTAL);
 prepareTimer = creatStageTimer(MeterInvocationConst.STAGE_PREPARE);
 handlersRequestTimer = 
creatStageTimer(MeterInvocationConst.STAGE_HANDLERS_REQUEST);
 handlersResponseTimer = 
creatStageTimer(MeterInvocationConst.STAGE_HANDLERS_RESPONSE);
   }
 
+  protected StatisticsBucket creatStageBucket(String bucketsValue) {
+return new StatisticsBucket(id.withTag(MeterInvocationConst.TAG_STAGE, 
bucketsValue));
 
 Review comment:
   So.  what value should I use 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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259170800
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,155 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  public static final long MS_UNIT = 1000_000L;
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY);
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(rootId.withTag("buckets_interval", 
latencyInterval.toString()),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property) {
+List results = new ArrayList<>();
+int[] arrays = Arrays.stream(property.trim().split(","))
+.mapToInt(Integer::parseInt)
+.distinct()
+.sorted()
+.filter(num -> num > 0)
+.toArray();
+if (arrays == null || arrays.length == 0) {
+  return results;
+}
+results.add(new LatencyInterval(0L, arrays[0] * MS_UNIT));
+for (int i = 1; i < arrays.length; i++) {
+  results.add(new LatencyInterval(arrays[i - 1] * MS_UNIT, arrays[i] * 
MS_UNIT));
+}
+results.add(new LatencyInterval(arrays[arrays.length - 1] * MS_UNIT, 
Long.MAX_VALUE));
+return results;
+  }
+
+  public static String getStrFormatFromProperty(List 
latencyIntervals) {
+StringBuilder stringBuilder = new StringBuilder();
+if (latencyIntervals == null || latencyIntervals.size() == 0) {
+  return stringBuilder.toString();
+}
+latencyIntervals.forEach(latency -> {
+  stringBuilder.append("%-")
+  .append(latency.toString().length())
+  .append("s ");
+});
+return stringBuilder.toString();
+  }
+
+  public static class LatencyInterval {
+
+private static final int leastLength = 7;
+
+private LongAdder times = new LongAdder();
+
+private long lastUpdated = 0L;
+
+private long minValue;
+
+private long maxValue;
+
+public LatencyInterval(long minValue, long maxValue) {
+  this.minValue = minValue;
+  this.maxValue = maxValue;
+}
+
+public boolean match(long num) {
+  return minValue <= num && maxValue > num;
+}
+
+public void increment() {
+  this.times.increment();
+}
+
+public long getAndUpdateLastTimes() {
+  long result = times.longValue() - lastUpdated;
 
 Review comment:
   done


This is 

[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259170762
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,155 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  public static final long MS_UNIT = 1000_000L;
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY);
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(rootId.withTag("buckets_interval", 
latencyInterval.toString()),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property) {
+List results = new ArrayList<>();
+int[] arrays = Arrays.stream(property.trim().split(","))
+.mapToInt(Integer::parseInt)
+.distinct()
+.sorted()
+.filter(num -> num > 0)
+.toArray();
+if (arrays == null || arrays.length == 0) {
+  return results;
+}
+results.add(new LatencyInterval(0L, arrays[0] * MS_UNIT));
+for (int i = 1; i < arrays.length; i++) {
+  results.add(new LatencyInterval(arrays[i - 1] * MS_UNIT, arrays[i] * 
MS_UNIT));
+}
+results.add(new LatencyInterval(arrays[arrays.length - 1] * MS_UNIT, 
Long.MAX_VALUE));
+return results;
+  }
+
+  public static String getStrFormatFromProperty(List 
latencyIntervals) {
 
 Review comment:
   I have moved it to the Class **DefaultLogPublisher**


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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259170367
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,155 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  public static final long MS_UNIT = 1000_000L;
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY);
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(rootId.withTag("buckets_interval", 
latencyInterval.toString()),
+  msNow, latencyInterval.getAndUpdateLastTimes()));
+});
+  }
+
+  private Measurement newMeasurement(Id id, long msNow, Number n) {
+return new Measurement(id, msNow, n.doubleValue());
+  }
+
+  public static List parseLatencyListFromProperty(String 
property) {
+List results = new ArrayList<>();
+int[] arrays = Arrays.stream(property.trim().split(","))
+.mapToInt(Integer::parseInt)
+.distinct()
+.sorted()
+.filter(num -> num > 0)
+.toArray();
+if (arrays == null || arrays.length == 0) {
+  return results;
+}
+results.add(new LatencyInterval(0L, arrays[0] * MS_UNIT));
 
 Review comment:
   done


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


With regards,
Apache Git Services


[GitHub] heyile commented on a change in pull request #1075: [SCB-359]Servicecomb support latency statistic

2019-02-21 Thread GitBox
heyile commented on a change in pull request #1075: [SCB-359]Servicecomb 
support latency statistic
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1075#discussion_r259169917
 
 

 ##
 File path: 
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/meter/StatisticsBucket.java
 ##
 @@ -0,0 +1,155 @@
+/*
+ * 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.meter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.spectator.api.Id;
+import com.netflix.spectator.api.Measurement;
+
+public class StatisticsBucket extends AbstractPeriodMeter {
+  public static final long MS_UNIT = 1000_000L;
+
+  public static final String TIME_INTERVAL = "timeInterval";
+
+  public static final String METRICS_LATENCY = 
DynamicPropertyFactory.getInstance()
+  .getStringProperty("servicecomb.metrics.invocation.latency.buckets", "0")
+  .get();
+
+  private Id rootId;
+
+  private List latencyIntervals;
+
+  public StatisticsBucket(Id id) {
+this.id = id;
+this.latencyIntervals = parseLatencyListFromProperty(METRICS_LATENCY);
+this.rootId = id.withTag("statistic", TIME_INTERVAL);
+  }
+
+  public void record(long nanoAmount) {
+if (nanoAmount > 0) {
+  for (LatencyInterval latencyInterval : latencyIntervals) {
+if (latencyInterval.match(nanoAmount)) {
+  latencyInterval.increment();
+  return;
+}
+  }
+}
+  }
+
+  @Override
+  public void calcMeasurements(long msNow, long secondInterval) {
+List measurements = new ArrayList<>();
+calcMeasurements(measurements, msNow, secondInterval);
+allMeasurements = measurements;
+  }
+
+  @Override
+  public void calcMeasurements(List measurements, long msNow, 
long secondInterval) {
+latencyIntervals.forEach(latencyInterval -> {
+  measurements.add(newMeasurement(rootId.withTag("buckets_interval", 
latencyInterval.toString()),
 
 Review comment:
   done


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


With regards,
Apache Git Services


[GitHub] coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's dependence on zuul

2019-02-21 Thread GitBox
coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's 
dependence on zuul
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1098#issuecomment-465496709
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/21757948/badge)](https://coveralls.io/builds/21757948)
   
   Coverage decreased (-0.009%) to 85.448% when pulling 
**a6a71b333437887b6b139fe29660a6e9c8ea328b on yangshaoqin1:SCB-1157** into 
**956ff0e21a2084ea615ce1cccd26249dbb193bf0 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


With regards,
Apache Git Services


[GitHub] coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's dependence on zuul

2019-02-21 Thread GitBox
coveralls edited a comment on issue #1098: [SCB-1157]Remove discovery's 
dependence on zuul
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1098#issuecomment-465496709
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/21757779/badge)](https://coveralls.io/builds/21757779)
   
   Coverage increased (+0.007%) to 85.464% when pulling 
**a6a71b333437887b6b139fe29660a6e9c8ea328b on yangshaoqin1:SCB-1157** into 
**956ff0e21a2084ea615ce1cccd26249dbb193bf0 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


With regards,
Apache Git Services


[GitHub] coveralls commented on issue #1099: [SCB-1153] provide traceId-invocationId by marker mechanism

2019-02-21 Thread GitBox
coveralls commented on issue #1099: [SCB-1153] provide traceId-invocationId by 
marker mechanism
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1099#issuecomment-466102635
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/21757279/badge)](https://coveralls.io/builds/21757279)
   
   Coverage decreased (-0.03%) to 85.424% when pulling 
**baf6137818eb1b204070d2e2556a9fa1507826a8 on 
wujimin:marker-with-traceId-invocationId** into 
**956ff0e21a2084ea615ce1cccd26249dbb193bf0 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


With regards,
Apache Git Services


[GitHub] coveralls commented on issue #536: SCB-1092 More abundant metrics information

2019-02-21 Thread GitBox
coveralls commented on issue #536: SCB-1092 More abundant metrics information
URL: 
https://github.com/apache/servicecomb-service-center/pull/536#issuecomment-466019057
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/21766543/badge)](https://coveralls.io/builds/21766543)
   
   Coverage increased (+0.001%) to 60.37% when pulling 
**8e27a369f5b1012d45dcd9a794d21c12c9cccf4f on little-cui:metrics** into 
**e1c525cccfa020c9e65212326c76fc20df348cd6 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


With regards,
Apache Git Services


[GitHub] codecov-io commented on issue #536: SCB-1092 More abundant metrics information

2019-02-21 Thread GitBox
codecov-io commented on issue #536: SCB-1092 More abundant metrics information
URL: 
https://github.com/apache/servicecomb-service-center/pull/536#issuecomment-466019039
 
 
   # 
[Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=h1)
 Report
   > Merging 
[#536](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=desc)
 into 
[master](https://codecov.io/gh/apache/servicecomb-service-center/commit/e1c525cccfa020c9e65212326c76fc20df348cd6?src=pr=desc)
 will **decrease** coverage by `<.01%`.
   > The diff coverage is `93.33%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/graphs/tree.svg?width=650=GAaF7zrg8R=150=pr)](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=tree)
   
   ```diff
   @@Coverage Diff @@
   ##   master #536  +/-   ##
   ==
   - Coverage   57.99%   57.99%   -0.01% 
   ==
 Files 185  185  
 Lines   1478214792  +10 
   ==
   + Hits 8573 8578   +5 
   - Misses   5613 5620   +7 
   + Partials  596  594   -2
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=tree)
 | Coverage Δ | |
   |---|---|---|
   | 
[server/notify/websocket.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL25vdGlmeS93ZWJzb2NrZXQuZ28=)
 | `81.97% <100%> (+0.31%)` | :arrow_up: |
   | 
[server/notify/metrics.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL25vdGlmeS9tZXRyaWNzLmdv)
 | `84.61% <100%> (+4.61%)` | :arrow_up: |
   | 
[server/notify/stream.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL25vdGlmeS9zdHJlYW0uZ28=)
 | `73.68% <87.5%> (+3.09%)` | :arrow_up: |
   | 
[server/notify/listwatcher.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL25vdGlmeS9saXN0d2F0Y2hlci5nbw==)
 | `69.44% <0%> (-9.73%)` | :arrow_down: |
   | 
[server/service/util/dependency.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvdXRpbC9kZXBlbmRlbmN5Lmdv)
 | `46.87% <0%> (-1.57%)` | :arrow_down: |
   | 
[server/broker/util.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL2Jyb2tlci91dGlsLmdv)
 | `53.47% <0%> (+0.26%)` | :arrow_up: |
   | 
[...erver/plugin/pkg/tracing/buildin/file\_collector.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-c2VydmVyL3BsdWdpbi9wa2cvdHJhY2luZy9idWlsZGluL2ZpbGVfY29sbGVjdG9yLmdv)
 | `64.07% <0%> (+0.97%)` | :arrow_up: |
   | 
[pkg/util/tree.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/536/diff?src=pr=tree#diff-cGtnL3V0aWwvdHJlZS5nbw==)
 | `84.37% <0%> (+3.12%)` | :arrow_up: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=footer).
 Last update 
[e1c525c...8e27a36](https://codecov.io/gh/apache/servicecomb-service-center/pull/536?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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


With regards,
Apache Git Services


[GitHub] WillemJiang closed issue #358: 包引用问题

2019-02-21 Thread GitBox
WillemJiang closed issue #358: 包引用问题
URL: https://github.com/apache/servicecomb-pack/issues/358
 
 
   


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


With regards,
Apache Git Services


[GitHub] wujimin merged pull request #1099: [SCB-1153] provide traceId-invocationId by marker mechanism

2019-02-21 Thread GitBox
wujimin merged pull request #1099: [SCB-1153] provide traceId-invocationId by 
marker mechanism
URL: https://github.com/apache/servicecomb-java-chassis/pull/1099
 
 
   


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


With regards,
Apache Git Services


[GitHub] wujimin opened a new pull request #1101: [SCB-1156] avoid collect wrong invocation stage data when rest invoke failed

2019-02-21 Thread GitBox
wujimin opened a new pull request #1101:  [SCB-1156] avoid collect wrong 
invocation stage data when rest invoke failed
URL: https://github.com/apache/servicecomb-java-chassis/pull/1101
 
 
   


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


With regards,
Apache Git Services


[servicecomb-java-chassis] branch master updated: [SCB-1153] provide traceId-invocationId by marker mechanism

2019-02-21 Thread wujimin
This is an automated email from the ASF dual-hosted git repository.

wujimin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
 new f3ec388  [SCB-1153] provide traceId-invocationId by marker mechanism
f3ec388 is described below

commit f3ec3889cedbb3c55be2d1dd60bf646da26ff3a5
Author: wujimin 
AuthorDate: Thu Feb 14 15:51:17 2019 +0800

[SCB-1153] provide traceId-invocationId by marker mechanism
---
 .../org/apache/servicecomb/core/Invocation.java| 13 
 .../apache/servicecomb/core/tracing/ScbMarker.java | 89 ++
 .../apache/servicecomb/core/TestInvocation.java| 17 +
 demo/perf/src/main/resources/logback.xml   |  2 +-
 .../metrics/core/publish/SlowInvocationLogger.java | 12 +--
 .../core/publish/TestSlowInvocationLogger.java |  3 -
 .../invocation/context/InvocationContext.java  |  9 +++
 7 files changed, 132 insertions(+), 13 deletions(-)

diff --git a/core/src/main/java/org/apache/servicecomb/core/Invocation.java 
b/core/src/main/java/org/apache/servicecomb/core/Invocation.java
index 46c3c4a..67b8494 100644
--- a/core/src/main/java/org/apache/servicecomb/core/Invocation.java
+++ b/core/src/main/java/org/apache/servicecomb/core/Invocation.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.servicecomb.core.definition.OperationMeta;
@@ -31,6 +32,7 @@ import 
org.apache.servicecomb.core.event.InvocationFinishEvent;
 import org.apache.servicecomb.core.event.InvocationStartEvent;
 import org.apache.servicecomb.core.invocation.InvocationStageTrace;
 import org.apache.servicecomb.core.provider.consumer.ReferenceConfig;
+import org.apache.servicecomb.core.tracing.ScbMarker;
 import org.apache.servicecomb.core.tracing.TraceIdGenerator;
 import org.apache.servicecomb.foundation.common.event.EventManager;
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
@@ -43,6 +45,8 @@ import 
org.apache.servicecomb.swagger.invocation.SwaggerInvocation;
 public class Invocation extends SwaggerInvocation {
   private static final Collection TRACE_ID_GENERATORS = 
loadTraceIdGenerators();
 
+  protected static final AtomicLong INVOCATION_ID = new AtomicLong();
+
   static Collection loadTraceIdGenerators() {
 return SPIServiceUtils.getPriorityHighestServices(generator -> 
generator.getName(), TraceIdGenerator.class);
   }
@@ -83,6 +87,12 @@ public class Invocation extends SwaggerInvocation {
   // because isEdge() only affect to apm/metrics output, no need to change so 
many logic
   private boolean edge;
 
+  private long invocationId;
+
+  public long getInvocationId() {
+return invocationId;
+  }
+
   public HttpServletRequestEx getRequestEx() {
 return requestEx;
   }
@@ -126,6 +136,7 @@ public class Invocation extends SwaggerInvocation {
   }
 
   private void init(OperationMeta operationMeta, Object[] swaggerArguments) {
+this.invocationId = INVOCATION_ID.getAndIncrement();
 this.schemaMeta = operationMeta.getSchemaMeta();
 this.operationMeta = operationMeta;
 this.swaggerArguments = swaggerArguments;
@@ -237,6 +248,8 @@ public class Invocation extends SwaggerInvocation {
 for (TraceIdGenerator traceIdGenerator : TRACE_ID_GENERATORS) {
   initTraceId(traceIdGenerator);
 }
+
+marker = new ScbMarker(this);
   }
 
   protected void initTraceId(TraceIdGenerator traceIdGenerator) {
diff --git 
a/core/src/main/java/org/apache/servicecomb/core/tracing/ScbMarker.java 
b/core/src/main/java/org/apache/servicecomb/core/tracing/ScbMarker.java
new file mode 100644
index 000..f2b5e76
--- /dev/null
+++ b/core/src/main/java/org/apache/servicecomb/core/tracing/ScbMarker.java
@@ -0,0 +1,89 @@
+/*
+ * 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.core.tracing;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.apache.servicecomb.core.Invocation;
+import org.slf4j.Marker;
+
+public 

[GitHub] WillemJiang commented on issue #359: Alpha集群如何保证高可用?

2019-02-21 Thread GitBox
WillemJiang commented on issue #359: Alpha集群如何保证高可用?
URL: 
https://github.com/apache/servicecomb-pack/issues/359#issuecomment-466012217
 
 
   @qcghdy Can you close the issue if you don't have any further question about 
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


With regards,
Apache Git Services


[GitHub] wujimin merged pull request #1098: [SCB-1157]Remove discovery's dependence on zuul

2019-02-21 Thread GitBox
wujimin merged pull request #1098: [SCB-1157]Remove discovery's dependence on 
zuul
URL: https://github.com/apache/servicecomb-java-chassis/pull/1098
 
 
   


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


With regards,
Apache Git Services


[GitHub] WillemJiang commented on issue #358: 包引用问题

2019-02-21 Thread GitBox
WillemJiang commented on issue #358: 包引用问题
URL: 
https://github.com/apache/servicecomb-pack/issues/358#issuecomment-466011879
 
 
   I'd like to close the issue as there is no feedback for one month.


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


With regards,
Apache Git Services


[servicecomb-java-chassis] branch master updated: [SCB-1157]Remove discovery's dependence on zuul

2019-02-21 Thread wujimin
This is an automated email from the ASF dual-hosted git repository.

wujimin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
 new f2d04d4  [SCB-1157]Remove discovery's dependence on zuul
f2d04d4 is described below

commit f2d04d4153c2eabc9909aea069109da51c8caacc
Author: yangshaoqin 
AuthorDate: Wed Feb 20 15:12:43 2019 +0800

[SCB-1157]Remove discovery's dependence on zuul
---
 .../src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java  | 3 ++-
 .../spring-boot-starter/spring-boot-starter-discovery/pom.xml | 4 
 .../spring-boot2-starter-discovery/pom.xml| 4 
 .../spring-boot2-starter-parent/spring-boot2-starter-gateway/pom.xml  | 4 
 4 files changed, 2 insertions(+), 13 deletions(-)

diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
index bb91446..90bbd49 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/deploy/NormalDeploy.java
@@ -25,6 +25,7 @@ import java.util.List;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
 import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.slf4j.Logger;
@@ -52,7 +53,7 @@ public class NormalDeploy {
 cmds = addArgs(cmds);
 
 this.prevFailCount = ITJUnitUtils.getFailures().size();
-
+LOGGER.info("createProcessBuilder: " + StringUtils.join(cmds, " ") + 
"\nWorkDir: " + deployDefinition.getWorkDir());
 subProcess = createProcessBuilder(cmds).start();
 subProcessCommandWriter = new BufferedWriter(new 
OutputStreamWriter(subProcess.getOutputStream()));
 subProcessLogger = new SubProcessLogger(deployDefinition.getDisplayName(), 
subProcess.getInputStream(),
diff --git 
a/java-chassis-spring-boot/spring-boot-starter/spring-boot-starter-discovery/pom.xml
 
b/java-chassis-spring-boot/spring-boot-starter/spring-boot-starter-discovery/pom.xml
index d67d753..f805678 100644
--- 
a/java-chassis-spring-boot/spring-boot-starter/spring-boot-starter-discovery/pom.xml
+++ 
b/java-chassis-spring-boot/spring-boot-starter/spring-boot-starter-discovery/pom.xml
@@ -55,10 +55,6 @@
 
 
   org.springframework.cloud
-  spring-cloud-starter-zuul
-
-
-  org.springframework.cloud
   spring-cloud-starter-ribbon
   
 
diff --git 
a/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-discovery/pom.xml
 
b/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-discovery/pom.xml
index e1446c2..9fb08f1 100644
--- 
a/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-discovery/pom.xml
+++ 
b/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-discovery/pom.xml
@@ -55,10 +55,6 @@
 
 
   org.springframework.cloud
-  spring-cloud-starter-netflix-zuul
-
-
-  org.springframework.cloud
   spring-cloud-starter-netflix-ribbon
   
 
diff --git 
a/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-gateway/pom.xml
 
b/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-gateway/pom.xml
index f2a50ff..29428d0 100644
--- 
a/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-gateway/pom.xml
+++ 
b/java-chassis-spring-boot/spring-boot2-starter-parent/spring-boot2-starter-gateway/pom.xml
@@ -55,10 +55,6 @@
   org.apache.servicecomb
   provider-springmvc
 
-
-  org.springframework.cloud
-  spring-cloud-starter-netflix-zuul
-
   
 
   



[GitHub] little-cui opened a new pull request #536: SCB-1092 More abundant metrics information

2019-02-21 Thread GitBox
little-cui opened a new pull request #536: SCB-1092 More abundant metrics 
information
URL: https://github.com/apache/servicecomb-service-center/pull/536
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks 
pass. A more thorough check will be performed on your pull request 
automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   


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


With regards,
Apache Git Services


[GitHub] WillemJiang closed issue #382: OptimisticLockException lead to Alpha Server normal service stop

2019-02-21 Thread GitBox
WillemJiang closed issue #382: OptimisticLockException  lead to Alpha Server  
normal service stop
URL: https://github.com/apache/servicecomb-pack/issues/382
 
 
   


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


With regards,
Apache Git Services


[GitHub] WillemJiang commented on issue #382: OptimisticLockException lead to Alpha Server normal service stop

2019-02-21 Thread GitBox
WillemJiang commented on issue #382: OptimisticLockException  lead to Alpha 
Server  normal service stop
URL: 
https://github.com/apache/servicecomb-pack/issues/382#issuecomment-465917910
 
 
   Just close the issue as we already merged the patch into master branch. 
   @airbaby  Can you verify 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


With regards,
Apache Git Services


[GitHub] WillemJiang opened a new pull request #413: SCB-1142 Clean up the alpha-spring-boot-starter

2019-02-21 Thread GitBox
WillemJiang opened a new pull request #413: SCB-1142 Clean up the 
alpha-spring-boot-starter
URL: https://github.com/apache/servicecomb-pack/pull/413
 
 
   Just fix the version issue of alpha-spring-boot-starter.


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


With regards,
Apache Git Services


[servicecomb-pack] branch SCB-1142 created (now 24f2969)

2019-02-21 Thread ningjiang
This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a change to branch SCB-1142
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git.


  at 24f2969  SCB-1142 Clean up the alpha-spring-boot-starter

This branch includes the following new commits:

 new 94cd93f  Initial commit
 new 9668231  JAV-198 initial commit with simplest core
 new 0a1670b  JAV-198 updated ignored files
 new 61e6b27  JAV-198 added compiler version
 new 08ebcd9  JAV-198 set up travis and code coverage
 new 9fa6c4f  JAV-198 added a simple readme
 new 915f9b1  JAV-198 made sure travis run build with java 1.8
 new c335330  JAV-199 implemented compensation logic
 new cd85cee  JAV-199 removed unnecessary generics
 new 4335709  JAV-220 compensated transactions on abort
 new 7fe90a5  JAV-220 minor test readability change
 new 0cac80c  JAV-209 supported forward recovery
 new 94f7516  JAV-197 able to recover saga state from events
 new 874ab2a  JAV-197 renamed event queue to event store
 new d451096  JAV-197 added saga coordinator
 new 9e9368c  JAV-197 made sure saga end state event can be played back
 new 657  JAV-197 covered compensation ended event
 new 2d841cf  JAV-224 removed unnecessary code
 new 15c9a5b  JAV-224 always changed to compensation state on abort
 new f42a603  JAV-224 retry once on transaction timeout
 new 2b52c6f  JAV-227 added logger config and some logging messages
 new 9e50cd8  use class method instead of detail implementation
 new 88c3ba2  JAV-225 directed acyclic graph implementation
 new 595367b  JAV-225 code tidy up
 new 75ef6a4  JAV-225 supported traversal in both directions
 new 9fe9291  JAV-225 able to process tasks in parallel
 new e553b2f  JAV-225 attempt to fix parallel request test case
 new 27c9153  JAV-225 simplified event id generation
 new 0a0c215  JAV-225 test cleanup
 new a704a9b  JAV-225 removed unused methods
 new 5b8238a  JAV-225 more appropriate naming for incomplete operations
 new 16e86bc  JAV-225 clearer log and fix of test with concurrency
 new 03b6f73  JAV-225 decoupled task execution from graph traversal
 new 2c6e611  JAV-225 flatten exception handling
 new 2396911  JAV-225 ensured parallel transactions are compensated on 
failure
 new 0d2be4b  JAV-225 shortened tests
 new 0842501  JAV-225 ensured saga stored from partially completed parallel 
transactions
 new aa81549  JAV-225 minor renaming
 new 4957be4  JAV-226 saved exception to saga log and ensured aborted saga 
can be restored
 new fcbce92  JAV-226 simplified event replay
 new dc833d9  JAV-200 deserialize json to saga requests
 new 63710fc  JAV-200 reduced saga task responsibility
 new ff8975c  JAV-200 grouped json interpretation related code together
 new a1f7c80  JAV-200 linked saga coordinator with interpreter
 new 62f6034  JAV-200 moved coordinator to application layer
 new d09189c  JAV-215 interpreter shouldn't care about how to create 
requests
 new 7c2c63f  JAV-215 embedded params into requests
 new 53a5e15  JAV-215 added transport with httpclient
 new 61fc372  JAV-215 parameter checking for rest transport
 new f3439c8  JAV-215 fixed test failure
 new b74c55d  JAV-215 wired transport with requests
 new 6cdb24a  JAV-215 to persist successful response with events
 new 0b5c8eb  JAV-215 validated rest methods
 new b2bc519  JAV-247 to recover saga from persistent log
 new 29edb8c  JAV-247 made saga task sub type of saga request
 new a06d6de  JAV-247 removed unused class
 new 106c3d7  JAV-247 added saga id to distinguish processes on requests
 new 5a2117a  JAV-247 supported parallel processing of requests
 new e844e88  JAV-247 made sure saga events are persisted first
 new 366c264  JAV-247 restful saga with spring boot
 new 6cb4200  JAV-247 changed test port to 8090, since it's not permitted 
on travis
 new ecf4183  JAV-247 used uuid as saga id to minimize collision
 new 97da74f  JAV-256 identify saga requests by id, since they may be 
deserialized from db
 new b2d2a2b  JAV-256 identify completed saga requests by id, since they 
may be constructed from db
 new 202e15b  JAV-256 identify aborted saga requests by id
 new 1cd8589  JAV-256 persisted events to database
 new d4195c7  JAV-256 suppressed unchecked warning in tests
 new e3b2461  JAV-256 queried incomplete sagas from log
 new 756dc6d  JAV-256 broken coupling between saga task & saga request to 
make serialization/deserialization easier
 new 7e57066  JAV-256 proper renaming for requests
 new 99b3514  JAV-256 deserialized saga start & end event
 new c01a1de  JAV-256 added production config with mysql config
 new 9e03fd7  JAV-297 added docker config
 new 3141048  JAV-297 added travel services for demo purpose
 new d92173d  JAV-297