[jira] [Commented] (SCB-1070) New instance 'TESTING' status

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


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

ASF GitHub Bot commented on SCB-1070:
-

little-cui closed pull request #507: SCB-1070 New instance 'TESTING' status
URL: https://github.com/apache/servicecomb-service-center/pull/507
 
 
   

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/server/core/proto/common.go b/server/core/proto/common.go
index c7c5eccf..f21dcf5f 100644
--- a/server/core/proto/common.go
+++ b/server/core/proto/common.go
@@ -32,6 +32,7 @@ const (
MSI_UP   string = "UP"
MSI_DOWN string = "DOWN"
MSI_STARTING string = "STARTING"
+   MSI_TESTING  string = "TESTING"
MSI_OUTOFSERVICE string = "OUTOFSERVICE"
 
CHECK_BY_HEARTBEAT string = "push"
diff --git a/server/service/instance_test.go b/server/service/instance_test.go
index 3b67e018..25b654fa 100644
--- a/server/service/instance_test.go
+++ b/server/service/instance_test.go
@@ -620,11 +620,43 @@ var _ = Describe("'Instance' service", func() {
It("should be passed", func() {
By("update instance status")
respUpdateStatus, err := 
instanceResource.UpdateStatus(getContext(), {
+   ServiceId:  serviceId,
+   InstanceId: instanceId,
+   Status: pb.MSI_DOWN,
+   })
+   Expect(err).To(BeNil())
+   
Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
+
+   respUpdateStatus, err = 
instanceResource.UpdateStatus(getContext(), {
+   ServiceId:  serviceId,
+   InstanceId: instanceId,
+   Status: pb.MSI_OUTOFSERVICE,
+   })
+   Expect(err).To(BeNil())
+   
Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
+
+   respUpdateStatus, err = 
instanceResource.UpdateStatus(getContext(), {
ServiceId:  serviceId,
InstanceId: instanceId,
Status: pb.MSI_STARTING,
})
+   Expect(err).To(BeNil())
+   
Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
+
+   respUpdateStatus, err = 
instanceResource.UpdateStatus(getContext(), {
+   ServiceId:  serviceId,
+   InstanceId: instanceId,
+   Status: pb.MSI_TESTING,
+   })
+
+   Expect(err).To(BeNil())
+   
Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
 
+   respUpdateStatus, err = 
instanceResource.UpdateStatus(getContext(), {
+   ServiceId:  serviceId,
+   InstanceId: instanceId,
+   Status: pb.MSI_UP,
+   })
Expect(err).To(BeNil())

Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
 
diff --git a/server/service/instance_validator.go 
b/server/service/instance_validator.go
index cf7a1dfb..bebb2c31 100644
--- a/server/service/instance_validator.go
+++ b/server/service/instance_validator.go
@@ -36,9 +36,9 @@ var (
 
 var (
instStatusRegex, _ = regexp.Compile("^(" + util.StringJoin([]string{
-   pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_OUTOFSERVICE}, 
"|") + ")?$")
+   pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_TESTING, 
pb.MSI_OUTOFSERVICE}, "|") + ")?$")
updateInstStatusRegex, _ = regexp.Compile("^(" + 
util.StringJoin([]string{
-   pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_OUTOFSERVICE}, 
"|") + ")$")
+   pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_TESTING, 
pb.MSI_OUTOFSERVICE}, "|") + ")$")
hbModeRegex, _   = regexp.Compile(`^(push|pull)$`)
urlRegex, _  = regexp.Compile(`^\S*$`)
epRegex, _   = regexp.Compile(`\S+`)


 


[jira] [Commented] (SCB-1053) Batch microservices instances discovery API

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


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

ASF GitHub Bot commented on SCB-1053:
-

little-cui closed pull request #506: SCB-1053 Allow instances to be nil
URL: https://github.com/apache/servicecomb-service-center/pull/506
 
 
   

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/server/core/proto/batch_find.go b/server/core/proto/batch_find.go
index 68e3883c..16eb99cc 100644
--- a/server/core/proto/batch_find.go
+++ b/server/core/proto/batch_find.go
@@ -27,7 +27,7 @@ type FindService struct {
 type FindResult struct {
Index int64   `protobuf:"varint,1,opt,name=index" 
json:"index"`
Rev   string  `protobuf:"bytes,2,opt,name=rev" 
json:"rev"`
-   Instances []*MicroServiceInstance 
`protobuf:"bytes,3,rep,name=instances" json:"instances"`
+   Instances []*MicroServiceInstance 
`protobuf:"bytes,3,rep,name=instances" json:"instances,omitempty"`
 }
 
 type FindFailedResult struct {


 


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


> Batch microservices instances discovery API
> ---
>
> Key: SCB-1053
> URL: https://issues.apache.org/jira/browse/SCB-1053
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
> Fix For: service-center-1.2.0
>
>




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


[jira] [Commented] (SCB-946) serialize/deseriaze List>/List>/Map>/Map>

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


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

ASF GitHub Bot commented on SCB-946:


wujimin opened a new pull request #1025: [SCB-946] serialize/deseriaze 
List>/List>/Map>/Map>
URL: https://github.com/apache/servicecomb-java-chassis/pull/1025
 
 
   protobuf idl can not describe List>/List>/Map>/Map>
   wrap them to standard proto message when serialize
   and unwrap when deserialize


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


> serialize/deseriaze List>/List>/Map>/Map Map>
> ---
>
> Key: SCB-946
> URL: https://issues.apache.org/jira/browse/SCB-946
> Project: Apache ServiceComb
>  Issue Type: Sub-task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
> Fix For: java-chassis-1.2.0
>
>




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


[jira] [Updated] (SCB-1037) in vertx 3.6.0, PumpImpl do not support "", it will throw exception

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 updated SCB-1037:
-
Description: 
so we avoid it by replace it with our own PumpImpl
when vertx is updated, we need delete our own PumpImpl


https://github.com/apache/servicecomb-java-chassis/pull/1001

  was:
so we avoid it by replace it with our own PumpImpl
when vertx is updated, we need delete our own PumpImpl


> in vertx 3.6.0, PumpImpl do not support "", it will throw exception
> ---
>
> Key: SCB-1037
> URL: https://issues.apache.org/jira/browse/SCB-1037
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Java-Chassis
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Critical
>
> so we avoid it by replace it with our own PumpImpl
> when vertx is updated, we need delete our own PumpImpl
> https://github.com/apache/servicecomb-java-chassis/pull/1001



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


[jira] [Assigned] (SCB-1060) edge support Exception converter

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 reassigned SCB-1060:


Assignee: 何一乐

> edge support Exception converter 
> -
>
> Key: SCB-1060
> URL: https://issues.apache.org/jira/browse/SCB-1060
> Project: Apache ServiceComb
>  Issue Type: Bug
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Major
>




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


[jira] [Closed] (SCB-1060) edge support Exception converter

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 closed SCB-1060.


> edge support Exception converter 
> -
>
> Key: SCB-1060
> URL: https://issues.apache.org/jira/browse/SCB-1060
> Project: Apache ServiceComb
>  Issue Type: Bug
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Major
>




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


[jira] [Closed] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 closed SCB-1047.

Resolution: Fixed

> microservice.yaml  service_description.version support format xxx.xx.xxx.xxx
> 
>
> Key: SCB-1047
> URL: https://issues.apache.org/jira/browse/SCB-1047
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Java-Chassis
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Major
>




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


[jira] [Closed] (SCB-1054) when download file, we should ignore consumer acceptType

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 closed SCB-1054.


> when download file, we should ignore consumer acceptType
> 
>
> Key: SCB-1054
> URL: https://issues.apache.org/jira/browse/SCB-1054
> Project: Apache ServiceComb
>  Issue Type: Bug
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Critical
>




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


[jira] [Closed] (SCB-1037) in vertx 3.6.0, PumpImpl do not support "", it will throw exception

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 closed SCB-1037.

Resolution: Fixed

> in vertx 3.6.0, PumpImpl do not support "", it will throw exception
> ---
>
> Key: SCB-1037
> URL: https://issues.apache.org/jira/browse/SCB-1037
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Java-Chassis
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Critical
>
> so we avoid it by replace it with our own PumpImpl
> when vertx is updated, we need delete our own PumpImpl
> https://github.com/apache/servicecomb-java-chassis/pull/1001



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


[jira] [Closed] (SCB-968) [SCB-968]968 http2 do not support pump download

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 closed SCB-968.
---
Resolution: Fixed
  Assignee: 何一乐

> [SCB-968]968 http2 do not support pump download
> ---
>
> Key: SCB-968
> URL: https://issues.apache.org/jira/browse/SCB-968
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Major
>
> when use http2 settings, TestDownload in demo will throw a can not save zero 
> bytes exception. as the last item in pending stack is empty string ""



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


[jira] [Resolved] (SCB-1044) add current process CPU rate and net packets in the metrics

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 resolved SCB-1044.
--
Resolution: Fixed

> add current process CPU rate  and net packets in the metrics
> 
>
> Key: SCB-1044
> URL: https://issues.apache.org/jira/browse/SCB-1044
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Java-Chassis
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Major
>




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


[jira] [Closed] (SCB-1051) when interface set produces=text/plain;charset=utf-8. and consumers set accept = text/plain,will cause error

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 closed SCB-1051.

Resolution: Fixed

> when interface set produces=text/plain;charset=utf-8. and consumers set 
> accept = text/plain,will cause error
> 
>
> Key: SCB-1051
> URL: https://issues.apache.org/jira/browse/SCB-1051
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Java-Chassis
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Major
> Attachments: screenshot-1.png
>
>




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


[jira] [Resolved] (SCB-1054) when download file, we should ignore consumer acceptType

2018-12-05 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/SCB-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

何一乐 resolved SCB-1054.
--
Resolution: Fixed

> when download file, we should ignore consumer acceptType
> 
>
> Key: SCB-1054
> URL: https://issues.apache.org/jira/browse/SCB-1054
> Project: Apache ServiceComb
>  Issue Type: Bug
>Reporter: 何一乐
>Assignee: 何一乐
>Priority: Critical
>




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


[jira] [Commented] (SCB-1060) edge support Exception converter

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


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

ASF GitHub Bot commented on SCB-1060:
-

liubao68 closed pull request #1018: [SCB-1060]edge support Exception converter
URL: https://github.com/apache/servicecomb-java-chassis/pull/1018
 
 
   

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/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
index 53edb8b9b..75f899195 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
@@ -31,6 +31,7 @@
 import org.apache.servicecomb.it.testcase.TestDefaultValue;
 import org.apache.servicecomb.it.testcase.TestDownload;
 import org.apache.servicecomb.it.testcase.TestDownloadSlowStreamEdge;
+import org.apache.servicecomb.it.testcase.TestExceptionConvertEdge;
 import org.apache.servicecomb.it.testcase.TestGenericEdge;
 import org.apache.servicecomb.it.testcase.TestIgnoreMethod;
 import org.apache.servicecomb.it.testcase.TestIgnoreStaticMethod;
@@ -106,6 +107,7 @@ private static void runShareTestCases() throws Throwable {
 ITJUnitUtils.runWithRest(TestAcceptType.class);
 
 ITJUnitUtils.runWithRest(TestDownload.class);
+ITJUnitUtils.runWithHighwayAndRest(TestExceptionConvertEdge.class);
 
 ITJUnitUtils.runWithHighwayAndRest(TestTrace.class);
 ITJUnitUtils.run(TestTraceEdge.class);
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestExceptionConvertEdge.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestExceptionConvertEdge.java
new file mode 100644
index 0..d022c2711
--- /dev/null
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestExceptionConvertEdge.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.it.testcase;
+
+import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestClientException;
+
+public class TestExceptionConvertEdge {
+  private static GateRestTemplate client = 
GateRestTemplate.createEdgeRestTemplate("edgeExceptionConvertSchema");
+
+  @Test
+  public void testTimeoutAdd() {
+int result = client.getForObject("/add?x=10=12", Integer.class);
+Assert.assertEquals(22, result);
+
+try {
+  client.getForObject("/add?x=88=21", Object.class);
+} catch (RestClientException e) {
+  HttpClientErrorException exception = (HttpClientErrorException) e;
+  Assert.assertEquals(HttpStatus.EXPECTATION_FAILED, 
exception.getStatusCode());
+  Assert.assertTrue(exception.getResponseBodyAsString().contains("change 
the response"));
+}
+  }
+}
diff --git 
a/integration-tests/it-edge/src/main/java/org/apache/servicecomb/it/edge/converter/CustomException.java
 
b/integration-tests/it-edge/src/main/java/org/apache/servicecomb/it/edge/converter/CustomException.java
new file mode 100644
index 0..e9f7fffec
--- /dev/null
+++ 
b/integration-tests/it-edge/src/main/java/org/apache/servicecomb/it/edge/converter/CustomException.java
@@ -0,0 +1,53 @@
+/*
+ * 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 

[jira] [Commented] (SCB-1068) As a developer want to know instance detail info when instance isolation

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


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

ASF GitHub Bot commented on SCB-1068:
-

liubao68 closed pull request #1024: [SCB-1068] add the instance infomation into 
instance isolation event
URL: https://github.com/apache/servicecomb-java-chassis/pull/1024
 
 
   

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/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/event/IsolationServerEvent.java
 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/event/IsolationServerEvent.java
index 4889aed20..1714e0b71 100644
--- 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/event/IsolationServerEvent.java
+++ 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/event/IsolationServerEvent.java
@@ -17,11 +17,16 @@
 package org.apache.servicecomb.loadbalance.event;
 
 import org.apache.servicecomb.foundation.common.event.AlarmEvent;
+import org.apache.servicecomb.loadbalance.ServiceCombServerStats;
+import org.apache.servicecomb.loadbalance.filter.IsolationDiscoveryFilter;
+import 
org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
 
 public class IsolationServerEvent extends AlarmEvent {
 
   private String microserviceName;
 
+  private MicroserviceInstance instance;
+
   //当前实例总请求数
   private long currentTotalRequest;
 
@@ -31,6 +36,8 @@
   //当前实例出错百分比
   private double currentErrorPercentage;
 
+  private int minIsolationTime;
+
   private long enableRequestThreshold;
 
   private int continuousFailureThreshold;
@@ -39,18 +46,20 @@
 
   private long singleTestTime;
 
-  public IsolationServerEvent(String microserviceName, long totalRequest, long 
currentCountinuousFailureCount,
-  double currentErrorPercentage, int continuousFailureThreshold,
-  int errorThresholdPercentage, long enableRequestThreshold, long 
singleTestTime, Type type) {
+  public IsolationServerEvent(String microserviceName, MicroserviceInstance 
instance,
+  ServiceCombServerStats serverStats,
+  IsolationDiscoveryFilter.Settings settings, Type type) {
 super(type);
 this.microserviceName = microserviceName;
-this.currentTotalRequest = totalRequest;
-this.currentCountinuousFailureCount = currentCountinuousFailureCount;
-this.currentErrorPercentage = currentErrorPercentage;
-this.enableRequestThreshold = enableRequestThreshold;
-this.continuousFailureThreshold = continuousFailureThreshold;
-this.errorThresholdPercentage = errorThresholdPercentage;
-this.singleTestTime = singleTestTime;
+this.currentTotalRequest = serverStats.getTotalRequests();
+this.currentCountinuousFailureCount = 
serverStats.getCountinuousFailureCount();
+this.currentErrorPercentage = serverStats.getFailedRate();
+this.minIsolationTime = settings.minIsolationTime;
+this.enableRequestThreshold = settings.enableRequestThreshold;
+this.continuousFailureThreshold = settings.continuousFailureThreshold;
+this.errorThresholdPercentage = settings.errorThresholdPercentage;
+this.singleTestTime = settings.singleTestTime;
+this.instance = instance;
   }
 
   public String getMicroserviceName() {
@@ -84,4 +93,12 @@ public int getErrorThresholdPercentage() {
   public long getSingleTestTime() {
 return singleTestTime;
   }
+
+  public MicroserviceInstance getInstance() {
+return instance;
+  }
+
+  public int getMinIsolationTime() {
+return minIsolationTime;
+  }
 }
diff --git 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
index f3e5c425a..2856434c0 100644
--- 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
+++ 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
@@ -45,17 +45,18 @@
 
   private static final Logger LOGGER = 
LoggerFactory.getLogger(IsolationDiscoveryFilter.class);
 
-  class Settings {
-int errorThresholdPercentage;
+  public class Settings {
+public int errorThresholdPercentage;
 
-long singleTestTime;
+public long singleTestTime;
 
-long enableRequestThreshold;
+public long enableRequestThreshold;
 
-int continuousFailureThreshold;
+public int continuousFailureThreshold;
 
-int minIsolationTime; // to avoid isolation recover too fast due to no 
concurrent control in concurrent scenario
+public int 

[jira] [Commented] (SCB-1070) New instance 'TESTING' status

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


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

ASF GitHub Bot commented on SCB-1070:
-

codecov-io commented on issue #507: SCB-1070 New instance 'TESTING' status
URL: 
https://github.com/apache/servicecomb-service-center/pull/507#issuecomment-20750
 
 
   # 
[Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/507?src=pr=h1)
 Report
   > Merging 
[#507](https://codecov.io/gh/apache/servicecomb-service-center/pull/507?src=pr=desc)
 into 
[master](https://codecov.io/gh/apache/servicecomb-service-center/commit/a0f5e64ef6112f69b68037c8877c6149f37cc18b?src=pr=desc)
 will **increase** coverage by `<.01%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/graphs/tree.svg?width=650=GAaF7zrg8R=150=pr)](https://codecov.io/gh/apache/servicecomb-service-center/pull/507?src=pr=tree)
   
   ```diff
   @@Coverage Diff @@
   ##   master #507  +/-   ##
   ==
   + Coverage   59.35%   59.36%   +<.01% 
   ==
 Files 166  166  
 Lines   1394413944  
   ==
   + Hits 8277 8278   +1 
 Misses   5081 5081  
   + Partials  586  585   -1
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/servicecomb-service-center/pull/507?src=pr=tree)
 | Coverage Δ | |
   |---|---|---|
   | 
[server/core/proto/common.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL2NvcmUvcHJvdG8vY29tbW9uLmdv)
 | `0% <ø> (ø)` | :arrow_up: |
   | 
[server/service/instance\_validator.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvaW5zdGFuY2VfdmFsaWRhdG9yLmdv)
 | `100% <ø> (ø)` | :arrow_up: |
   | 
[server/plugin/pkg/registry/etcd/etcd.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL3BsdWdpbi9wa2cvcmVnaXN0cnkvZXRjZC9ldGNkLmdv)
 | `86.17% <0%> (-0.19%)` | :arrow_down: |
   | 
[server/broker/service.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL2Jyb2tlci9zZXJ2aWNlLmdv)
 | `57.78% <0%> (-0.16%)` | :arrow_down: |
   | 
[server/broker/util.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL2Jyb2tlci91dGlsLmdv)
 | `53.47% <0%> (+0.26%)` | :arrow_up: |
   | 
[server/service/notification/stream.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2Uvbm90aWZpY2F0aW9uL3N0cmVhbS5nbw==)
 | `69.56% <0%> (+4.34%)` | :arrow_up: |
   | 
[server/plugin/pkg/registry/etcd/tracing.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/507/diff?src=pr=tree#diff-c2VydmVyL3BsdWdpbi9wa2cvcmVnaXN0cnkvZXRjZC90cmFjaW5nLmdv)
 | `81.81% <0%> (+9.09%)` | :arrow_up: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/507?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/507?src=pr=footer).
 Last update 
[a0f5e64...1960c6c](https://codecov.io/gh/apache/servicecomb-service-center/pull/507?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


> New instance 'TESTING' status
> -
>
> Key: SCB-1070
> URL: https://issues.apache.org/jira/browse/SCB-1070
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
> Fix For: service-center-1.2.0
>
>




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


[jira] [Commented] (SCB-1053) Batch microservices instances discovery API

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


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

ASF GitHub Bot commented on SCB-1053:
-

codecov-io commented on issue #506: SCB-1053 Allow instances to be nil
URL: 
https://github.com/apache/servicecomb-service-center/pull/506#issuecomment-20306
 
 
   # 
[Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/506?src=pr=h1)
 Report
   > Merging 
[#506](https://codecov.io/gh/apache/servicecomb-service-center/pull/506?src=pr=desc)
 into 
[master](https://codecov.io/gh/apache/servicecomb-service-center/commit/a0f5e64ef6112f69b68037c8877c6149f37cc18b?src=pr=desc)
 will **decrease** coverage by `0.02%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/servicecomb-service-center/pull/506/graphs/tree.svg?width=650=GAaF7zrg8R=150=pr)](https://codecov.io/gh/apache/servicecomb-service-center/pull/506?src=pr=tree)
   
   ```diff
   @@Coverage Diff @@
   ##   master #506  +/-   ##
   ==
   - Coverage   59.35%   59.33%   -0.03% 
   ==
 Files 166  166  
 Lines   1394413944  
   ==
   - Hits 8277 8274   -3 
 Misses   5081 5081  
   - Partials  586  589   +3
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/servicecomb-service-center/pull/506?src=pr=tree)
 | Coverage Δ | |
   |---|---|---|
   | 
[server/govern/service.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/506/diff?src=pr=tree#diff-c2VydmVyL2dvdmVybi9zZXJ2aWNlLmdv)
 | `72.6% <0%> (-0.34%)` | :arrow_down: |
   | 
[server/plugin/pkg/registry/etcd/etcd.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/506/diff?src=pr=tree#diff-c2VydmVyL3BsdWdpbi9wa2cvcmVnaXN0cnkvZXRjZC9ldGNkLmdv)
 | `86.17% <0%> (-0.19%)` | :arrow_down: |
   | 
[server/broker/service.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/506/diff?src=pr=tree#diff-c2VydmVyL2Jyb2tlci9zZXJ2aWNlLmdv)
 | `57.78% <0%> (-0.16%)` | :arrow_down: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/506?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/506?src=pr=footer).
 Last update 
[a0f5e64...cc8ad54](https://codecov.io/gh/apache/servicecomb-service-center/pull/506?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


> Batch microservices instances discovery API
> ---
>
> Key: SCB-1053
> URL: https://issues.apache.org/jira/browse/SCB-1053
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
> Fix For: service-center-1.2.0
>
>




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


[jira] [Commented] (SCB-1070) New instance 'TESTING' status

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


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

ASF GitHub Bot commented on SCB-1070:
-

little-cui opened a new pull request #507: SCB-1070 New instance 'TESTING' 
status
URL: https://github.com/apache/servicecomb-service-center/pull/507
 
 
   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


> New instance 'TESTING' status
> -
>
> Key: SCB-1070
> URL: https://issues.apache.org/jira/browse/SCB-1070
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
> Fix For: service-center-1.2.0
>
>




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


[jira] [Commented] (SCB-1053) Batch microservices instances discovery API

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


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

ASF GitHub Bot commented on SCB-1053:
-

little-cui opened a new pull request #506: SCB-1053 allow instances to be nil
URL: https://github.com/apache/servicecomb-service-center/pull/506
 
 
   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


> Batch microservices instances discovery API
> ---
>
> Key: SCB-1053
> URL: https://issues.apache.org/jira/browse/SCB-1053
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
> Fix For: service-center-1.2.0
>
>




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


[jira] [Updated] (SCB-1070) New instance 'TESTING' status

2018-12-05 Thread little-cui (JIRA)


 [ 
https://issues.apache.org/jira/browse/SCB-1070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

little-cui updated SCB-1070:

Due Date: 7/Dec/18  (was: 14/Dec/18)

> New instance 'TESTING' status
> -
>
> Key: SCB-1070
> URL: https://issues.apache.org/jira/browse/SCB-1070
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
> Fix For: service-center-1.2.0
>
>




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


[jira] [Resolved] (SCB-1048) Provide a way to configure bootstrap information in Cloud Native enviroment

2018-12-05 Thread liubao (JIRA)


 [ 
https://issues.apache.org/jira/browse/SCB-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liubao resolved SCB-1048.
-
Resolution: Fixed

> Provide a way to configure bootstrap information in Cloud Native enviroment
> ---
>
> Key: SCB-1048
> URL: https://issues.apache.org/jira/browse/SCB-1048
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Java-Chassis
>Reporter: liubao
>Assignee: liubao
>Priority: Major
> Fix For: java-chassis-1.2.0
>
>
> # About Bootstrap Module
> Bootstrap is a mechanism to manage how microservics interact with external 
> services. When running a microservic in a Cloud Native enviroment, it will 
> interact with many external services, like service center, config center, an 
> APM service to report tracing data, a dashboard service to report health 
> data, etc. Bootstrap manages the meta data of these services. Bootstrap 
> queries the addresses , the parameters, the authentication information of 
> these services and so on.
> Bootstrap is some kind of service like service center, they are differ from 
> two aspects:
> 1. All microservics will report their information to service center. But 
> Bootstrap acts as a management system and knows the meta information in 
> deploy time. 
> 2. Service center provide some other functions like instance management and 
> heartbeat, But Bootstrap only provide metadata query services and it is 
> simple.
> Bootstrap does not provide a management service, it providers the interface 
> to interacts with management service. Service Providers can implement the 
> interface.
> They are some design constraints need to be considered when implment 
> Bootstrap interface:
> 1. Bootstrap can only read configurations of environment, microservics.yaml. 
> It can not read dynamic configurations.
> 2. Bootstrap is initialized before bean initialization.



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


[jira] [Created] (SCB-1070) New instance 'TESTING' status

2018-12-05 Thread little-cui (JIRA)
little-cui created SCB-1070:
---

 Summary: New instance 'TESTING' status
 Key: SCB-1070
 URL: https://issues.apache.org/jira/browse/SCB-1070
 Project: Apache ServiceComb
  Issue Type: Improvement
  Components: Service-Center
Reporter: little-cui
Assignee: little-cui
 Fix For: service-center-1.2.0






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


[jira] [Resolved] (SCB-1063) Improve the time cost when first time loading schema

2018-12-05 Thread liubao (JIRA)


 [ 
https://issues.apache.org/jira/browse/SCB-1063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liubao resolved SCB-1063.
-
   Resolution: Fixed
Fix Version/s: java-chassis-1.2.0

> Improve the time cost when first time loading schema
> 
>
> Key: SCB-1063
> URL: https://issues.apache.org/jira/browse/SCB-1063
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Java-Chassis
>Reporter: liubao
>Assignee: liubao
>Priority: Major
> Fix For: java-chassis-1.2.0
>
>
> When first time to invoke a service, will download each schema and compile 
> classes. Sometimes users got hundreds of schema, this will taken more than 
> 30s and the first time invocation can get easily timeout. 
>  
> There are some improvements can be done:
>  # loading and compile concurrently
>  # fetch all schema in one invocation in service center. 
>  
> Notice:
>  for edge, we should not cache all microservice schema, because some deleted 
> service will not be used forever. 
>  



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


[jira] [Resolved] (SCB-1061) Provide a way to using handlers(e.g. LoabalanceHanler) outside handler chain

2018-12-05 Thread liubao (JIRA)


 [ 
https://issues.apache.org/jira/browse/SCB-1061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liubao resolved SCB-1061.
-
Resolution: Fixed

> Provide a way to using handlers(e.g. LoabalanceHanler) outside handler chain
> 
>
> Key: SCB-1061
> URL: https://issues.apache.org/jira/browse/SCB-1061
> Project: Apache ServiceComb
>  Issue Type: New Feature
>Reporter: liubao
>Assignee: liubao
>Priority: Major
> Fix For: java-chassis-1.2.0
>
>
> In Edge Service, users want to dispatch requests to non ServiceComb services 
> like tomcat webpage. And users implement a Dispatcher, and want to maintain 
> isolation, loadbalance features as ServiceComb client did. 
>  
> Here is an example on how to use : 
> https://github.com/huaweicse/cse-java-chassis-samples/blob/master/porter/gateway-service/src/main/java/com/huawei/cse/porter/gateway/UiDispatcher.java



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


[jira] [Commented] (SCB-1065) when request not contain traceId,should use provider's invocation's traceId

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


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

ASF GitHub Bot commented on SCB-1065:
-

liubao68 closed pull request #1022: [SCB-1065] when request not contain 
traceId,should use provider's invocation's traceId
URL: https://github.com/apache/servicecomb-java-chassis/pull/1022
 
 
   

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/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
 
b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
index 932aef4c3..08dc3802a 100644
--- 
a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
+++ 
b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
@@ -103,7 +103,7 @@ protected void setContext() throws Exception {
 @SuppressWarnings("unchecked")
 Map cseContext =
 JsonUtils.readValue(strCseContext.getBytes(StandardCharsets.UTF_8), 
Map.class);
-invocation.setContext(cseContext);
+invocation.mergeContext(cseContext);
   }
 
   public String getContext(String key) {
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
index faf37a539..d57ebe06c 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
@@ -250,6 +250,34 @@ public void setContextNormal() throws Exception {
 Assert.assertThat(invocation.getContext(), Matchers.hasEntry("name", 
"value"));
   }
 
+  @Test
+  public void setContextTraceId() throws Exception {
+Map context = new HashMap<>();
+new Expectations() {
+  {
+requestEx.getHeader(Const.CSE_CONTEXT);
+result = JsonUtils.writeValueAsString(context);
+  }
+};
+invocation.addContext("X-B3-traceId", "value1");
+//if request has no traceId, use invocation's traceId
+restInvocation.setContext();
+Assert.assertThat(invocation.getContext().size(), Matchers.is(1));
+Assert.assertThat(invocation.getContext(), 
Matchers.hasEntry("X-B3-traceId", "value1"));
+
+context.put("X-B3-traceId", "value2");
+new Expectations() {
+  {
+requestEx.getHeader(Const.CSE_CONTEXT);
+result = JsonUtils.writeValueAsString(context);
+  }
+};
+//if request has traceId, use request's traceId
+restInvocation.setContext();
+Assert.assertThat(invocation.getContext().size(), Matchers.is(1));
+Assert.assertThat(invocation.getContext(), 
Matchers.hasEntry("X-B3-traceId", "value2"));
+  }
+
   @Test
   public void getContext() {
 invocation.addContext("key", "test");
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java
index 2edeca77e..0807beb1c 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java
@@ -19,6 +19,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import javax.ws.rs.core.Response.Status;
 import javax.ws.rs.core.Response.StatusType;
@@ -68,6 +69,24 @@ public void addContext(Map otherContext) {
 context.putAll(otherContext);
   }
 
+  public void mergeContext(InvocationContext otherContext) {
+mergeContext(otherContext.getContext());
+  }
+
+  public void mergeContext(Map otherContext) {
+if (otherContext == null) {
+  return;
+}
+if (otherContext.size() > context.size()) {
+  for (Entry entry : context.entrySet()) {
+otherContext.putIfAbsent(entry.getKey(), entry.getValue());
+  }
+  this.context = otherContext;
+  return;
+}
+context.putAll(otherContext);
+  }
+
   public Map getLocalContext() {
 return localContext;
   }
diff --git 
a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/context/TestInvocationContext.java
 
b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/context/TestInvocationContext.java
new file mode 100644
index 

[jira] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics

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


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

ASF GitHub Bot commented on SCB-1044:
-

liubao68 closed pull request #1012: [SCB-1044]add current process CPU rate  and 
net packets in the metrics
URL: https://github.com/apache/servicecomb-java-chassis/pull/1012
 
 
   

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-common/src/main/java/org/apache/servicecomb/foundation/common/net/NetUtils.java
 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/net/NetUtils.java
index c03061ab8..30f8e29db 100644
--- 
a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/net/NetUtils.java
+++ 
b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/net/NetUtils.java
@@ -238,10 +238,10 @@ public static boolean canTcpListen(InetAddress address, 
int port) {
   public static String humanReadableBytes(long bytes) {
 int unit = 1024;
 if (bytes < unit) {
-  return bytes + " B";
+  return bytes + "";
 }
 int exp = (int) (Math.log(bytes) / Math.log(unit));
 char pre = "KMGTPE".charAt(exp - 1);
-return String.format("%.3f %cB", bytes / Math.pow(unit, exp), pre);
+return String.format("%.3f%c", bytes / Math.pow(unit, exp), pre);
   }
 }
diff --git 
a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/net/TestNetUtils.java
 
b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/net/TestNetUtils.java
index 15c6a9ed5..15e157fc8 100644
--- 
a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/net/TestNetUtils.java
+++ 
b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/net/TestNetUtils.java
@@ -110,40 +110,39 @@ public void testCanTcpListenYes() throws IOException {
 
   @Test
   public void humanReadableBytes() throws IOException {
-Assert.assertEquals("0 B", NetUtils.humanReadableBytes(0L));
-Assert.assertEquals("1 B", NetUtils.humanReadableBytes(1L));
-Assert.assertEquals("1023 B", NetUtils.humanReadableBytes(1023L));
-
-Assert.assertEquals("1.000 KB", NetUtils.humanReadableBytes(1024L));
-Assert.assertEquals("1.001 KB", NetUtils.humanReadableBytes(1025L));
-Assert.assertEquals("1023.999 KB", NetUtils.humanReadableBytes(1024L * 
1024 - 1));
-
-Assert.assertEquals("1.000 MB", NetUtils.humanReadableBytes(1024L * 1024));
-Assert.assertEquals("1.000 MB", NetUtils.humanReadableBytes(1024L * 1024 + 
1));
-Assert.assertEquals("1.001 MB", NetUtils.humanReadableBytes(1024L * 1024 + 
1024));
-Assert.assertEquals("1023.999 MB", NetUtils.humanReadableBytes(1024L * 
1024 * 1024 - 1024));
-Assert.assertEquals("1024.000 MB", NetUtils.humanReadableBytes(1024L * 
1024 * 1024 - 1));
-
-Assert.assertEquals("1.000 GB", NetUtils.humanReadableBytes(1024L * 1024 * 
1024));
-Assert.assertEquals("1.000 GB", NetUtils.humanReadableBytes(1024L * 1024 * 
1024 + 1));
-Assert.assertEquals("1.000 GB", NetUtils.humanReadableBytes(1024L * 1024 * 
1024 + 1024));
-Assert.assertEquals("1023.999 GB", NetUtils.humanReadableBytes(1024L * 
1024 * 1024 * 1024 - 1024 * 1024));
-Assert.assertEquals("1024.000 GB", NetUtils.humanReadableBytes(1024L * 
1024 * 1024 * 1024 - 1024));
-Assert.assertEquals("1.000 TB", NetUtils.humanReadableBytes(1024L * 1024 * 
1024 * 1024));
-Assert.assertEquals("1.001 TB", NetUtils.humanReadableBytes(1024L * 1024 * 
1024 * 1024 + 1024 * 1024 * 1024));
-Assert.assertEquals("1023.999 TB",
+Assert.assertEquals("0", NetUtils.humanReadableBytes(0L));
+Assert.assertEquals("1", NetUtils.humanReadableBytes(1L));
+Assert.assertEquals("1023", NetUtils.humanReadableBytes(1023L));
+
+Assert.assertEquals("1.000K", NetUtils.humanReadableBytes(1024L));
+Assert.assertEquals("1.001K", NetUtils.humanReadableBytes(1025L));
+Assert.assertEquals("1023.999K", NetUtils.humanReadableBytes(1024L * 1024 
- 1));
+
+Assert.assertEquals("1.000M", NetUtils.humanReadableBytes(1024L * 1024));
+Assert.assertEquals("1.000M", NetUtils.humanReadableBytes(1024L * 1024 + 
1));
+Assert.assertEquals("1.001M", NetUtils.humanReadableBytes(1024L * 1024 + 
1024));
+Assert.assertEquals("1023.999M", NetUtils.humanReadableBytes(1024L * 1024 
* 1024 - 1024));
+Assert.assertEquals("1024.000M", NetUtils.humanReadableBytes(1024L * 1024 
* 1024 - 1));
+Assert.assertEquals("1.000G", NetUtils.humanReadableBytes(1024L * 1024 * 
1024));
+Assert.assertEquals("1.000G", NetUtils.humanReadableBytes(1024L * 1024 * 

[jira] [Updated] (SCB-921) check if swagger compatible to protobuf and choose transport automatically

2018-12-05 Thread wujimin (JIRA)


 [ 
https://issues.apache.org/jira/browse/SCB-921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

wujimin updated SCB-921:

Description: 
include these rules at least:
 * not support List/List  (try to support)
 * array in deserialize target model (try to support)   
(https://github.com/protocolbuffers/protobuf/issues/3749)
 * file upload and download

  was:
include these rules at least:
 * not support List/List  (try to support)
 * array in deserialize target model (try to support)
 * file upload and download


> check if swagger compatible to protobuf and choose transport automatically
> --
>
> Key: SCB-921
> URL: https://issues.apache.org/jira/browse/SCB-921
> Project: Apache ServiceComb
>  Issue Type: Task
>  Components: Java-Chassis
>Reporter: wujimin
>Assignee: wujimin
>Priority: Major
> Fix For: java-chassis-1.2.0
>
>
> include these rules at least:
>  * not support List/List  (try to support)
>  * array in deserialize target model (try to support)   
> (https://github.com/protocolbuffers/protobuf/issues/3749)
>  * file upload and download



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


[jira] [Commented] (SCB-1066) when start error, destroy method may throw an exception lead to origin exception losed

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


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

ASF GitHub Bot commented on SCB-1066:
-

liubao68 closed pull request #1023: [SCB-1066] when start error, destroy method 
may throw an exception le…
URL: https://github.com/apache/servicecomb-java-chassis/pull/1023
 
 
   

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/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java 
b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
index f364d1c6f..7cdb51e7b 100644
--- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
+++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java
@@ -211,7 +211,11 @@ public synchronized void init() {
   } catch (TimeoutException e) {
 LOGGER.warn("{}", e.getMessage());
   } catch (Throwable e) {
-destroy();
+try {
+  destroy();
+} catch (Exception exception) {
+  LOGGER.info("destroy has some error.", exception);
+}
 status = SCBStatus.FAILED;
 throw new IllegalStateException("ServiceComb init failed.", e);
   }
diff --git 
a/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
 
b/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
index 12a555b1a..737792a16 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/provider/producer/ProducerProviderManager.java
@@ -63,7 +63,9 @@ public void onBootEvent(BootEvent event) {
 if (!EventType.AFTER_CLOSE.equals(event.getEventType())) {
   return;
 }
-
+if (microserviceMeta == null) {
+  return;
+}
 for (OperationMeta operationMeta : microserviceMeta.getOperations()) {
   if (ExecutorService.class.isInstance(operationMeta.getExecutor())) {
 ((ExecutorService) operationMeta.getExecutor()).shutdown();
diff --git 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
index b0d29ee8e..201ceb5f5 100644
--- 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
+++ 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/LocalServiceRegistryClientImpl.java
@@ -219,6 +219,9 @@ public String 
registerMicroserviceInstance(MicroserviceInstance instance) {
 
   @Override
   public boolean unregisterMicroserviceInstance(String microserviceId, String 
microserviceInstanceId) {
+if (microserviceId == null) {
+  return true;
+}
 Map instanceMap = 
microserviceInstanceMap.get(microserviceId);
 if (instanceMap != null) {
   instanceMap.remove(microserviceInstanceId);


 


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


> when start error, destroy method may throw an exception lead to origin 
> exception losed
> --
>
> Key: SCB-1066
> URL: https://issues.apache.org/jira/browse/SCB-1066
> Project: Apache ServiceComb
>  Issue Type: Bug
>  Components: Java-Chassis
>Reporter: jeho0815
>Assignee: jeho0815
>Priority: Major
> Attachments: image-2018-12-04-21-25-08-309.png
>
>
>  
> 1、when operationid repead, ProducerProviderManager shutdown error with a NPE
> 2、using LocalServiceRegistryClientImpl 
> !image-2018-12-04-21-25-08-309.png!
>  



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