[jira] [Commented] (SCB-1068) As a developer want to know instance detail info when instance isolation
[ https://issues.apache.org/jira/browse/SCB-1068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709673#comment-16709673 ] ASF GitHub Bot commented on SCB-1068: - jeho0815 opened a new pull request #1024: [SCB-1068] add the instance infomation into instance isolation event URL: https://github.com/apache/servicecomb-java-chassis/pull/1024 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` 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 > As a developer want to know instance detail info when instance isolation > - > > Key: SCB-1068 > URL: https://issues.apache.org/jira/browse/SCB-1068 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Reporter: jeho0815 >Assignee: jeho0815 >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-1054) when download file, we should ignore consumer acceptType
[ https://issues.apache.org/jira/browse/SCB-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709665#comment-16709665 ] ASF GitHub Bot commented on SCB-1054: - wujimin closed pull request #1016: [SCB-1054]when download file, we should ignore consumer acceptType URL: https://github.com/apache/servicecomb-java-chassis/pull/1016 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/definition/RestOperationMeta.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java index ee7c40137..99d7a8970 100644 --- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java +++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java @@ -25,6 +25,7 @@ import java.util.Locale; import java.util.Map; +import javax.servlet.http.Part; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; @@ -35,9 +36,12 @@ import org.apache.servicecomb.common.rest.definition.path.URLPathBuilder; import org.apache.servicecomb.core.definition.OperationMeta; import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx; +import org.apache.servicecomb.swagger.invocation.response.ResponseMeta; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.JavaType; + import io.swagger.models.Operation; import io.swagger.models.Swagger; import io.swagger.models.parameters.Parameter; @@ -52,6 +56,9 @@ protected boolean formData; + // make sure if response is file + protected boolean downloadFile; + protected List paramList = new ArrayList<>(); // key为参数名 @@ -80,13 +87,14 @@ public void init(OperationMeta operationMeta) { this.produces = swagger.getProduces(); } +this.downloadFile = checkDownloadFileFlag(); this.createProduceProcessors(); Method method = operationMeta.getMethod(); Type[] genericParamTypes = method.getGenericParameterTypes(); if (genericParamTypes.length != operation.getParameters().size()) { throw new Error("Param count is not equal between swagger and method, path=" + absolutePath -+ ";operation=" + operationMeta.getMicroserviceQualifiedName()); + + ";operation=" + operationMeta.getMicroserviceQualifiedName()); } // 初始化所有rest param @@ -105,6 +113,15 @@ public void init(OperationMeta operationMeta) { setAbsolutePath(concatPath(swagger.getBasePath(), operationMeta.getOperationPath())); } + private boolean checkDownloadFileFlag() { +ResponseMeta responseMeta = operationMeta.findResponseMeta(200); +if (responseMeta != null) { + JavaType javaType = responseMeta.getJavaType(); + return javaType.getRawClass().equals(Part.class); +} +return false; + } + public boolean isFormData() { return formData; } @@ -214,12 +231,17 @@ public ProduceProcessor ensureFindProduceProcessor(HttpServletRequestEx requestE } public ProduceProcessor ensureFindProduceProcessor(String acceptType) { +if (downloadFile) { + //do not check accept type, when the produces of provider is text/plain there will return text/plain processor + //when the produces of provider is application/json there will return the application/json processor + //so do not care what accept type the consumer will set. + return this.produceProcessorMap.get(MediaType.WILDCARD); +} if (StringUtils.isEmpty(acceptType)) { return defaultProcessor; } - -List mimeTyps = MimeTypesUtils.getSortedAcceptableMimeTypes(acceptType.toLowerCase(Locale.US)); -for (String mime : mimeTyps) { +List mimeTypes = MimeTypesUtils.getSortedAcceptableMimeTypes(acceptType.toLowerCase(Locale.US)); +for (String mime : mimeTypes) { ProduceProcessor processor = this.produceProcessorMap.get(mime); if (null != processor) { return processor; diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java index 34621d6e2..623e1171a 100644 --- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java +++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java @@ -171,6 +171,20 @@ public void testEnsureFindProduceProcessorAcceptFound() {
[jira] [Commented] (SCB-1051) when interface set produces=text/plain;charset=utf-8. and consumers set accept = text/plain,will cause error
[ https://issues.apache.org/jira/browse/SCB-1051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709659#comment-16709659 ] ASF GitHub Bot commented on SCB-1051: - wujimin closed pull request #1015: [SCB-1051]when interface set produces=text/plain;charset=utf-8. and c… URL: https://github.com/apache/servicecomb-java-chassis/pull/1015 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/definition/RestOperationMeta.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java index ee7c40137..36979ea92 100644 --- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java +++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java @@ -173,6 +173,9 @@ protected void createProduceProcessors() { } } else { for (String produce : produces) { +if (produce.contains(";")) { + produce = produce.substring(0, produce.indexOf(";")); +} ProduceProcessor processor = ProduceProcessorManager.INSTANCE.findValue(produce); if (processor == null) { LOGGER.error("produce {} is not supported", produce); diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java index 34621d6e2..6103df9ed 100644 --- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java +++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java @@ -147,6 +147,18 @@ public void testCreateProduceProcessorsTextAndWildcard() { MediaType.APPLICATION_JSON + "," + MediaType.APPLICATION_XML + "," + MediaType.WILDCARD)); } + @Test + public void testCreateProduceProcessorsWithSemicolon() { +RestOperationMeta operationMeta = new RestOperationMeta(); +operationMeta.produces = Arrays +.asList(MediaType.TEXT_PLAIN + ";charset=UTF-8", MediaType.APPLICATION_JSON + ";charset=UTF-8"); +operationMeta.createProduceProcessors(); +Assert.assertSame(ProduceProcessorManager.PLAIN_PROCESSOR, +operationMeta.ensureFindProduceProcessor(MediaType.TEXT_PLAIN)); +Assert.assertSame(ProduceProcessorManager.JSON_PROCESSOR, +operationMeta.ensureFindProduceProcessor(MediaType.APPLICATION_JSON)); + } + @Test public void testEnsureFindProduceProcessorRequest(@Mocked HttpServletRequestEx requestEx) { RestOperationMeta operationMeta = new RestOperationMeta(); 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 0ef503900..53edb8b9b 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 @@ -22,6 +22,7 @@ import org.apache.servicecomb.it.deploy.MicroserviceDeploy; import org.apache.servicecomb.it.junit.ITJUnitUtils; import org.apache.servicecomb.it.schema.TestApiOperation; +import org.apache.servicecomb.it.testcase.TestAcceptType; import org.apache.servicecomb.it.testcase.TestAnnotatedAttribute; import org.apache.servicecomb.it.testcase.TestApiParam; import org.apache.servicecomb.it.testcase.TestChangeTransport; @@ -102,6 +103,7 @@ private static void runShareTestCases() throws Throwable { // only rest support default value feature ITJUnitUtils.runWithRest(TestDefaultValue.class); +ITJUnitUtils.runWithRest(TestAcceptType.class); ITJUnitUtils.runWithRest(TestDownload.class); diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java new file mode 100644 index 0..9b2f2b18e --- /dev/null +++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java @@ -0,0 +1,102 @@ +/* + * 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
[jira] [Commented] (SCB-1065) when request not contain traceId,should use provider's invocation's traceId
[ https://issues.apache.org/jira/browse/SCB-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709566#comment-16709566 ] ASF GitHub Bot commented on SCB-1065: - weichao666 commented on a change in 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#discussion_r238920499 ## File path: swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java ## @@ -68,6 +68,22 @@ 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()) { + otherContext.putAll(context); Review comment: done, use otherContext.putIfAbsent, when otherContext's key is already exists, use otherContext's value, when otherContext does not contain key, use context's value 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 request not contain traceId,should use provider's invocation's traceId > --- > > Key: SCB-1065 > URL: https://issues.apache.org/jira/browse/SCB-1065 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis >Reporter: WeiChao >Assignee: WeiChao >Priority: Major > Fix For: java-chassis-1.2.0 > > > when request not contain traceId,should use provider's invocation's traceId -- 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
[ https://issues.apache.org/jira/browse/SCB-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709565#comment-16709565 ] ASF GitHub Bot commented on SCB-1065: - weichao666 commented on a change in 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#discussion_r238919805 ## File path: 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.addContext(cseContext); 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 > when request not contain traceId,should use provider's invocation's traceId > --- > > Key: SCB-1065 > URL: https://issues.apache.org/jira/browse/SCB-1065 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis >Reporter: WeiChao >Assignee: WeiChao >Priority: Major > Fix For: java-chassis-1.2.0 > > > when request not contain traceId,should use provider's invocation's traceId -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (SCB-1068) As a developer want to know instance detail info when instance isolation
jeho0815 created SCB-1068: - Summary: As a developer want to know instance detail info when instance isolation Key: SCB-1068 URL: https://issues.apache.org/jira/browse/SCB-1068 Project: Apache ServiceComb Issue Type: Improvement Components: Java-Chassis Reporter: jeho0815 Assignee: jeho0815 -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (SCB-1066) when start error, destroy method may throw an exception lead to origin exception missed
[ https://issues.apache.org/jira/browse/SCB-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] jeho0815 updated SCB-1066: -- Summary: when start error, destroy method may throw an exception lead to origin exception missed (was: when start error, destroy may throw an exception lead to origin exception missed) > when start error, destroy method may throw an exception lead to origin > exception missed > --- > > 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)
[jira] [Commented] (SCB-1066) when start error, destroy method may throw an exception lead to origin exception losed
[ https://issues.apache.org/jira/browse/SCB-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709560#comment-16709560 ] ASF GitHub Bot commented on SCB-1066: - jeho0815 opened a new 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 …ad to origin exception losed 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` 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 > 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)
[jira] [Updated] (SCB-1066) when start error, destroy method may throw an exception lead to origin exception losed
[ https://issues.apache.org/jira/browse/SCB-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] jeho0815 updated SCB-1066: -- Summary: when start error, destroy method may throw an exception lead to origin exception losed (was: when start error, destroy method may throw an exception lead to origin exception missed) > 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)
[jira] [Resolved] (SCB-1056) Put provider QPS flow control in front
[ https://issues.apache.org/jira/browse/SCB-1056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] YaoHaishi resolved SCB-1056. Resolution: Fixed Fix Version/s: java-chassis-1.2.0 PR has been merged. The other task is tracked by SCB-1056. > Put provider QPS flow control in front > -- > > Key: SCB-1056 > URL: https://issues.apache.org/jira/browse/SCB-1056 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > Fix For: java-chassis-1.2.0 > > > Currently provider QPS flow control is in ProviderQpsFlowControlHandler which > works in provider handler chain. As a result, the flow control logic takes > effect too late and much CPU resource is wasted on processing those requests > that should be rejected earlier. > Put the provider QPS flow control logic in front can save the resource. -- 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
[ https://issues.apache.org/jira/browse/SCB-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709524#comment-16709524 ] ASF GitHub Bot commented on SCB-1065: - jeho0815 commented on a change in 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#discussion_r238906399 ## File path: swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java ## @@ -68,6 +68,22 @@ 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()) { + otherContext.putAll(context); Review comment: > 1.loop context and otherContext.putIfAbsent > 2.still did not process highway transport? new traceid created in invocation.onStart, then merge context. if only merge absent keys, the traceid is the new one. can we put the merge context before invocation.onStart? 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 request not contain traceId,should use provider's invocation's traceId > --- > > Key: SCB-1065 > URL: https://issues.apache.org/jira/browse/SCB-1065 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis >Reporter: WeiChao >Assignee: WeiChao >Priority: Major > Fix For: java-chassis-1.2.0 > > > when request not contain traceId,should use provider's invocation's traceId -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-1051) when interface set produces=text/plain;charset=utf-8. and consumers set accept = text/plain,will cause error
[ https://issues.apache.org/jira/browse/SCB-1051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709403#comment-16709403 ] ASF GitHub Bot commented on SCB-1051: - coveralls edited a comment on issue #1015: [SCB-1051]when interface set produces=text/plain;charset=utf-8. and c… URL: https://github.com/apache/servicecomb-java-chassis/pull/1015#issuecomment-442428828 [![Coverage Status](https://coveralls.io/builds/20445930/badge)](https://coveralls.io/builds/20445930) Coverage decreased (-0.003%) to 86.715% when pulling **eeaef6f635b87c4ff17bd77b72a608f9997a3ed7 on heyile:producerCharset** into **a21611163909bd075f3f7c737474e44c95f4c062 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 > 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] [Commented] (SCB-1054) when download file, we should ignore consumer acceptType
[ https://issues.apache.org/jira/browse/SCB-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709382#comment-16709382 ] ASF GitHub Bot commented on SCB-1054: - coveralls edited a comment on issue #1016: [SCB-1054]when download file, we should ignore consumer acceptType URL: https://github.com/apache/servicecomb-java-chassis/pull/1016#issuecomment-442685627 [![Coverage Status](https://coveralls.io/builds/20444824/badge)](https://coveralls.io/builds/20444824) Coverage increased (+0.03%) to 86.744% when pulling **bae955707154770cf34d71da051feb3234d0b799 on heyile:downloadAccept** into **a21611163909bd075f3f7c737474e44c95f4c062 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 > 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-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16709114#comment-16709114 ] ASF GitHub Bot commented on SCB-1044: - coveralls edited a comment on issue #1012: [SCB-1044]add current process CPU rate and net packets in the metrics URL: https://github.com/apache/servicecomb-java-chassis/pull/1012#issuecomment-441660699 [![Coverage Status](https://coveralls.io/builds/20441172/badge)](https://coveralls.io/builds/20441172) Coverage increased (+0.02%) to 86.733% when pulling **906d4936bbe3d3834d8435d6fd8b7a1474d707a9 on heyile:cpuAndNet** into **f4b9d7b460497aff6eeab432d5b570abdb934edb 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 > 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] [Updated] (SCB-945) enhance swagger to idl to support method parameter/result/List/List/Map/Map
[ https://issues.apache.org/jira/browse/SCB-945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] wujimin updated SCB-945: Summary: enhance swagger to idl to support method parameter/result/List/List/Map/Map (was: codec of invocation parameters) > enhance swagger to idl to support method > parameter/result/List/List/Map/Map > - > > Key: SCB-945 > URL: https://issues.apache.org/jira/browse/SCB-945 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (SCB-1067) serialize/deserialize method parameters and result
wujimin created SCB-1067: Summary: serialize/deserialize method parameters and result Key: SCB-1067 URL: https://issues.apache.org/jira/browse/SCB-1067 Project: Apache ServiceComb Issue Type: Sub-task Components: Java-Chassis Reporter: wujimin Assignee: wujimin Fix For: java-chassis-1.2.0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (SCB-946) serialize/deseriaze List>/List>/Map>/Map>
[ https://issues.apache.org/jira/browse/SCB-946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] wujimin updated SCB-946: Fix Version/s: java-chassis-1.2.0 > 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-946) serialize/deseriaze List>/List>/Map>/Map>
[ https://issues.apache.org/jira/browse/SCB-946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] wujimin updated SCB-946: Summary: serialize/deseriaze List>/List>/Map>/Map> (was: support google.protobuf.Empty for return void) > 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 > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (SCB-676) protobuf codec based on idl
[ https://issues.apache.org/jira/browse/SCB-676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] wujimin updated SCB-676: Description: compare to jackson protobuf: * can parse protobuf 3 proto file * support protobuf 3: map/any compare to protoStuff runtime: * for a proto message type, not only support strong type(Pojo), but alse support weak type(Map) * support "any" type * support generic pojo type, eg:CustomGeneric compare to standard protobuf: * extend "any" type, for standard not support cases, use "json" schema to codec it. compare to all: * just pojo, no need any code generation and annotation * one pojo can serialize to different version proto file to support different version server * wrap List>/List>/Map>/Map> to standard proto idl, makes model more flexible * support text data come from http,can serrialize from different data type ** number fields (int32/int64 and so on) *** number *** String *** String[] ** string fields *** string *** string[] ** bool fields *** boolean *** string *** string[] ** enum fields *** enum *** number *** string *** string[] was: compare to jackson protobuf: * can parse protobuf 3 proto file * support protobuf 3: map/any compare to protoStuff runtime: * for a proto message type, not only support strong type(Pojo), but alse support weak type(Map) * support "any" type * support generic pojo type, eg:CustomGeneric * DO NOT support List>/List> any more, because protobuf specification not support it, and the parser can not parse the proto file compare to standard protobuf: * extend "any" type, for standard not support cases, use "json" schema to codec it. compare to all: * just pojo, no need any code generation and annotation * one pojo can serialize to different version proto file to support different version server * support text data come from http,can serrialize from different data type ** number fields (int32/int64 and so on) *** number *** String *** String[] ** string fields *** string *** string[] ** bool fields *** boolean *** string *** string[] ** enum fields *** enum *** number *** string *** string[] > protobuf codec based on idl > --- > > Key: SCB-676 > URL: https://issues.apache.org/jira/browse/SCB-676 > Project: Apache ServiceComb > Issue Type: Task > Components: Java-Chassis >Reporter: wujimin >Assignee: wujimin >Priority: Major > > compare to jackson protobuf: > * can parse protobuf 3 proto file > * support protobuf 3: map/any > compare to protoStuff runtime: > * for a proto message type, not only support strong type(Pojo), but alse > support weak type(Map) > * support "any" type > * support generic pojo type, eg:CustomGeneric > compare to standard protobuf: > * extend "any" type, for standard not support cases, use "json" schema to > codec it. > compare to all: > * just pojo, no need any code generation and annotation > * one pojo can serialize to different version proto file to support > different version server > * wrap List>/List>/Map>/Map> to > standard proto idl, makes model more flexible > * support text data come from http,can serrialize from different data type > ** number fields (int32/int64 and so on) > *** number > *** String > *** String[] > ** string fields > *** string > *** string[] > ** bool fields > *** boolean > *** string > *** string[] > ** enum fields > *** enum > *** number > *** string > *** string[] -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708980#comment-16708980 ] ASF GitHub Bot commented on SCB-1047: - coveralls edited a comment on issue #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#issuecomment-441953809 [![Coverage Status](https://coveralls.io/builds/20438583/badge)](https://coveralls.io/builds/20438583) Coverage decreased (-0.0008%) to 86.711% when pulling **e0a23a8d9efd55548d39598b144a38ac91651c85 on heyile:versionFour** into **2bb90ab5d7e1d333141e07db23f02569307d6ef1 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 > 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] [Commented] (SCB-1049) Alarm center
[ https://issues.apache.org/jira/browse/SCB-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708984#comment-16708984 ] ASF GitHub Bot commented on SCB-1049: - coveralls edited a comment on issue #503: WIP: SCB-1049 Alarm center URL: https://github.com/apache/servicecomb-service-center/pull/503#issuecomment-443585336 [![Coverage Status](https://coveralls.io/builds/20445080/badge)](https://coveralls.io/builds/20445080) Coverage decreased (-0.1%) to 61.712% when pulling **7184fc2e96cff1e9de0e3e08b9e0e025cfcc5508 on little-cui:alarm** into **b2bc7a931a2bde31f1ee0f8e5e5348de9a7f67bf 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 > Alarm center > > > Key: SCB-1049 > URL: https://issues.apache.org/jira/browse/SCB-1049 > Project: Apache ServiceComb > Issue Type: New Feature > 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-1049) Alarm center
[ https://issues.apache.org/jira/browse/SCB-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708817#comment-16708817 ] ASF GitHub Bot commented on SCB-1049: - codecov-io edited a comment on issue #503: WIP: SCB-1049 Alarm center URL: https://github.com/apache/servicecomb-service-center/pull/503#issuecomment-443584904 # [Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/503?src=pr=h1) Report > Merging [#503](https://codecov.io/gh/apache/servicecomb-service-center/pull/503?src=pr=desc) into [master](https://codecov.io/gh/apache/servicecomb-service-center/commit/b2bc7a931a2bde31f1ee0f8e5e5348de9a7f67bf?src=pr=desc) will **decrease** coverage by `0.15%`. > The diff coverage is `70.08%`. [![Impacted file tree graph](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/graphs/tree.svg?width=650=GAaF7zrg8R=150=pr)](https://codecov.io/gh/apache/servicecomb-service-center/pull/503?src=pr=tree) ```diff @@Coverage Diff@@ ## master#503 +/- ## = - Coverage 59.35% 59.2% -0.16% = Files 166 168 +2 Lines 13944 14017 +73 = + Hits 82778299 +22 - Misses 50815132 +51 Partials 586 586 ``` | [Impacted Files](https://codecov.io/gh/apache/servicecomb-service-center/pull/503?src=pr=tree) | Coverage Δ | | |---|---|---| | [server/notify/publisher.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL25vdGlmeS9wdWJsaXNoZXIuZ28=) | `95.65% <ø> (ø)` | | | [server/service/event/instance\_event\_handler.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvZXZlbnQvaW5zdGFuY2VfZXZlbnRfaGFuZGxlci5nbw==) | `7.54% <0%> (ø)` | :arrow_up: | | [...erver/plugin/pkg/discovery/servicecenter/syncer.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL3BsdWdpbi9wa2cvZGlzY292ZXJ5L3NlcnZpY2VjZW50ZXIvc3luY2VyLmdv) | `41.17% <0%> (-1.58%)` | :arrow_down: | | [server/core/config.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL2NvcmUvY29uZmlnLmdv) | `0% <0%> (ø)` | :arrow_up: | | [server/service/event/rule\_event\_handler.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvZXZlbnQvcnVsZV9ldmVudF9oYW5kbGVyLmdv) | `8.33% <0%> (ø)` | :arrow_up: | | [server/service/event/tag\_event\_handler.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvZXZlbnQvdGFnX2V2ZW50X2hhbmRsZXIuZ28=) | `7.14% <0%> (ø)` | :arrow_up: | | [server/service/instance.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL3NlcnZpY2UvaW5zdGFuY2UuZ28=) | `67.75% <0%> (-0.5%)` | :arrow_down: | | [server/admin/controller\_v4.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL2FkbWluL2NvbnRyb2xsZXJfdjQuZ28=) | `16.21% <10%> (-6.01%)` | :arrow_down: | | [pkg/util/json.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-cGtnL3V0aWwvanNvbi5nbw==) | `100% <100%> (ø)` | | | [server/error/error.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree#diff-c2VydmVyL2Vycm9yL2Vycm9yLmdv) | `100% <100%> (ø)` | :arrow_up: | | ... and [26 more](https://codecov.io/gh/apache/servicecomb-service-center/pull/503/diff?src=pr=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/503?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/503?src=pr=footer). Last update [b2bc7a9...7184fc2](https://codecov.io/gh/apache/servicecomb-service-center/pull/503?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 > Alarm center > > > Key: SCB-1049 > URL: https://issues.apache.org/jira/browse/SCB-1049 > Project: Apache
[jira] [Commented] (SCB-1051) when interface set produces=text/plain;charset=utf-8. and consumers set accept = text/plain,will cause error
[ https://issues.apache.org/jira/browse/SCB-1051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708816#comment-16708816 ] ASF GitHub Bot commented on SCB-1051: - heyile commented on a change in pull request #1015: [SCB-1051]when interface set produces=text/plain;charset=utf-8. and c… URL: https://github.com/apache/servicecomb-java-chassis/pull/1015#discussion_r238695923 ## File path: integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestAcceptType.java ## @@ -0,0 +1,110 @@ +/* + * 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.Consumers; +import org.apache.servicecomb.swagger.invocation.exception.InvocationException; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; + +public class TestAcceptType { + interface AcceptTypeIntf { + } + + private static Consumers consumersAcceptTypeSpringmvc = new Consumers<>("acceptTypeSpringmvcSchema", + AcceptTypeIntf.class); + + private static Consumers consumersAcceptTypeJaxrs = new Consumers<>("acceptTypeJaxrsSchema", + AcceptTypeIntf.class); + + + @Test + public void testTextPlain_rt() { +checkTextPlain(consumersAcceptTypeSpringmvc); +checkTextPlain(consumersAcceptTypeJaxrs); + } + + private void checkTextPlain(Consumers consumers) { +String result = textHeader_rt(consumers, MediaType.TEXT_PLAIN_VALUE); +Assert.assertEquals("cse", result); + +try { + textHeader_rt(consumers, MediaType.APPLICATION_JSON_VALUE); + Assert.fail("should throw exception"); +} catch (InvocationException e) { + Assert.assertEquals(406, e.getStatusCode()); + Assert.assertTrue(e.getMessage().contains("Accept application/json is not supported")); +} catch (Exception e) { Review comment: ok 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 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] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708730#comment-16708730 ] ASF GitHub Bot commented on SCB-1044: - heyile commented on a change in 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#discussion_r238671015 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/cpu/OsCpuUsage.java ## @@ -0,0 +1,68 @@ +/* + * 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.metrics.core.meter.os.cpu; + +import com.google.common.annotations.VisibleForTesting; +import com.netflix.spectator.api.Id; + +/* + * unit : 1 jiffies = 10ms = 0.01 s + * more details : + * http://man7.org/linux/man-pages/man5/proc.5.html + * CMD : /proc/stat + * cpu 2445171 599297 353967 24490633 11242 0107802993 0 0 + * cpu usernice system idle iowait irq softirq stealstolen guest guest_nice + * 01 2 3 456 78 + * total = user + nice + system + idle + iowait + irq + softirq + stealstolen + * busy = total - idle + */ +public class OsCpuUsage extends AbstractCpuUsage { + private long lastTotalTime; + + private long currentTotalTime; + + public OsCpuUsage(Id id) { +super(id, "/proc/stat"); + } + + @Override + protected void update(String[] stats) { +currentTotalTime = readCurrentTotalTime(stats); +periodTotalTime = currentTotalTime - lastTotalTime; +lastTotalTime = currentTotalTime; + +super.update(stats); + } + + private long readCurrentTotalTime(String[] stats) { +long total = 0L; +for (int i = 1; i <= 8; i++) { + total += Long.parseLong(stats[i]); +} +return total; + } + + @Override + protected long readCurrentBusyTime(String[] stats) { +return currentTotalTime - Long.parseLong(stats[4]); + } + + @VisibleForTesting Review comment: ok, I will delete 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 > 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] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708736#comment-16708736 ] ASF GitHub Bot commented on SCB-1044: - heyile commented on a change in 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#discussion_r238671350 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/NetMeter.java ## @@ -43,101 +46,48 @@ public static final Tag TAG_RECEIVE = new BasicTag(STATISTIC, "receive"); - public static final Tag TAG_SEND = new BasicTag(STATISTIC, "send"); - - private final Id id; - - private Map interfaceInfoMap = new ConcurrentHashMap<>(); - - public static class InterfaceInfo { -private final String name; - -private Id sendId; - -private Id receiveId; - -//receive bytes -private long lastRxBytes; - -//transmit bytes -private long lastTxBytes; - -// bytes per second -private double sendRate; - -private double receiveRate; - -InterfaceInfo(Id id, String name) { - this.name = name; - id = id.withTag(INTERFACE, name); - this.sendId = id.withTag(TAG_SEND); - this.receiveId = id.withTag(TAG_RECEIVE); -} - -public void update(String interfaceData, long secondInterval) { - String[] netInfo = interfaceData.trim().split("\\s+"); - long rxBytes = Long.parseLong(netInfo[0]); - long txBytes = Long.parseLong(netInfo[8]); - sendRate = (double) (txBytes - lastTxBytes) / secondInterval; - receiveRate = (double) (rxBytes - lastRxBytes) / secondInterval; - lastRxBytes = rxBytes; - lastTxBytes = txBytes; -} - -public String getName() { - return name; -} + public static final Tag TAG_PACKETS_RECEIVE = new BasicTag(STATISTIC, "receivePackets"); -public long getLastRxBytes() { - return lastRxBytes; -} + public static final Tag TAG_SEND = new BasicTag(STATISTIC, "send"); -public long getLastTxBytes() { - return lastTxBytes; -} + public static final Tag TAG_PACKETS_SEND = new BasicTag(STATISTIC, "sendPackets"); -public double getSendRate() { - return sendRate; -} + private final Id id; -public double getReceiveRate() { - return receiveRate; -} - } + private Map interfaceUsageMap = new ConcurrentHashMap<>(); public NetMeter(Id id) { this.id = id; - -// init lastRxBytes and lastTxBytes +// init lastRxBytes, lastRxPackets, lastTxBytes, lastTxPackets refreshNet(1); -for (InterfaceInfo interfaceInfo : interfaceInfoMap.values()) { - interfaceInfo.sendRate = 0; - interfaceInfo.receiveRate = 0; -} +interfaceUsageMap.values().forEach(interfaceUsage -> { + interfaceUsage.getNetStats().forEach(NetStat::clearRate); +}); } public void calcMeasurements(List measurements, long msNow, long secondInterval) { refreshNet(secondInterval); -for (InterfaceInfo interfaceInfo : interfaceInfoMap.values()) { - measurements.add(new Measurement(interfaceInfo.sendId, msNow, interfaceInfo.sendRate)); - measurements.add(new Measurement(interfaceInfo.receiveId, msNow, interfaceInfo.receiveRate)); -} +interfaceUsageMap.values().stream() Review comment: I see 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 > 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] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708735#comment-16708735 ] ASF GitHub Bot commented on SCB-1044: - heyile commented on a change in 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#discussion_r238672021 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/CpuMeter.java ## @@ -16,92 +16,59 @@ */ package org.apache.servicecomb.metrics.core.meter.os; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.List; -import org.apache.commons.io.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.servicecomb.metrics.core.meter.os.cpu.OsCpuUsage; +import org.apache.servicecomb.metrics.core.meter.os.cpu.ProcessCpuUsage; +import com.google.common.annotations.VisibleForTesting; +import com.netflix.spectator.api.BasicTag; import com.netflix.spectator.api.Id; import com.netflix.spectator.api.Measurement; +import com.netflix.spectator.api.Tag; public class CpuMeter { - private static final Logger LOGGER = LoggerFactory.getLogger(CpuMeter.class); - private double rate; + public static final Tag TAG_All = new BasicTag(OsMeter.OS_TYPE, OsMeter.OS_TYPE_ALL_CPU); - private long lastTotalTime; + public static final Tag TAG_CURRENT = new BasicTag(OsMeter.OS_TYPE, OsMeter.OS_TYPE_PROCESS_CPU); Review comment: ok. I will modify 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 > 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] [Commented] (SCB-1056) Put provider QPS flow control in front
[ https://issues.apache.org/jira/browse/SCB-1056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708727#comment-16708727 ] ASF GitHub Bot commented on SCB-1056: - liubao68 closed pull request #1017: [SCB-1056] put provider flow control logic in front URL: https://github.com/apache/servicecomb-java-chassis/pull/1017 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..d2b08aa05 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 @@ -26,6 +26,7 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response.Status; +import javax.xml.ws.Holder; import org.apache.commons.lang3.StringUtils; import org.apache.servicecomb.common.rest.codec.produce.ProduceProcessor; @@ -36,6 +37,7 @@ import org.apache.servicecomb.common.rest.locator.OperationLocator; import org.apache.servicecomb.common.rest.locator.ServicePathManager; import org.apache.servicecomb.core.Const; +import org.apache.servicecomb.core.Handler; import org.apache.servicecomb.core.Invocation; import org.apache.servicecomb.core.definition.MicroserviceMeta; import org.apache.servicecomb.core.definition.OperationMeta; @@ -126,6 +128,19 @@ protected void scheduleInvocation() { invocation.getInvocationStageTrace().startSchedule(); OperationMeta operationMeta = restOperationMeta.getOperationMeta(); +try { + this.setContext(); +} catch (Exception e) { + LOGGER.error("failed to set invocation context", e); + sendFailResponse(e); + return; +} + +Holder qpsFlowControlReject = checkQpsFlowControl(operationMeta); +if (qpsFlowControlReject.value) { + return; +} + operationMeta.getExecutor().execute(() -> { synchronized (this.requestEx) { try { @@ -150,6 +165,26 @@ protected void scheduleInvocation() { }); } + private Holder checkQpsFlowControl(OperationMeta operationMeta) { +Holder qpsFlowControlReject = new Holder<>(false); +@SuppressWarnings("deprecation") +Handler providerQpsFlowControlHandler = operationMeta.getProviderQpsFlowControlHandler(); +if (null != providerQpsFlowControlHandler) { + try { +providerQpsFlowControlHandler.handle(invocation, response -> { + qpsFlowControlReject.value = true; + produceProcessor = ProduceProcessorManager.JSON_PROCESSOR; + sendResponse(response); +}); + } catch (Exception e) { +LOGGER.error("failed to execute ProviderQpsFlowControlHandler", e); +qpsFlowControlReject.value = true; +sendFailResponse(e); + } +} +return qpsFlowControlReject; + } + private boolean isInQueueTimeout() { return System.nanoTime() - invocation.getInvocationStageTrace().getStart() > CommonRestConfig.getRequestWaitInPoolTimeout() * 1_000_000; @@ -183,7 +218,6 @@ public void invoke() { protected Response prepareInvoke() throws Throwable { this.initProduceProcessor(); -this.setContext(); invocation.getHandlerContext().put(RestConst.REST_REQUEST, requestEx); invocation.getInvocationStageTrace().startServerFiltersRequest(); @@ -201,9 +235,7 @@ protected Response prepareInvoke() throws Throwable { protected void doInvoke() throws Throwable { invocation.getInvocationStageTrace().startHandlersRequest(); -invocation.next(resp -> { - sendResponseQuietly(resp); -}); +invocation.next(resp -> sendResponseQuietly(resp)); } public void sendFailResponse(Throwable throwable) { 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..5a8c85962 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 @@ -17,6 +17,8 @@ package org.apache.servicecomb.common.rest; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -49,10 +51,11 @@ import org.apache.servicecomb.foundation.common.utils.JsonUtils; import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils; import
[jira] [Created] (SCB-1066) when start error, destroy may throw an exception lead to origin exception missed
jeho0815 created SCB-1066: - Summary: when start error, destroy may throw an exception lead to origin exception missed 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 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)
[jira] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708681#comment-16708681 ] ASF GitHub Bot commented on SCB-1044: - wujimin commented on a change in 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#discussion_r238655349 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/cpu/OsCpuUsage.java ## @@ -0,0 +1,68 @@ +/* + * 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.metrics.core.meter.os.cpu; + +import com.google.common.annotations.VisibleForTesting; +import com.netflix.spectator.api.Id; + +/* + * unit : 1 jiffies = 10ms = 0.01 s + * more details : + * http://man7.org/linux/man-pages/man5/proc.5.html + * CMD : /proc/stat + * cpu 2445171 599297 353967 24490633 11242 0107802993 0 0 + * cpu usernice system idle iowait irq softirq stealstolen guest guest_nice + * 01 2 3 456 78 + * total = user + nice + system + idle + iowait + irq + softirq + stealstolen + * busy = total - idle + */ +public class OsCpuUsage extends AbstractCpuUsage { + private long lastTotalTime; + + private long currentTotalTime; + + public OsCpuUsage(Id id) { +super(id, "/proc/stat"); + } + + @Override + protected void update(String[] stats) { +currentTotalTime = readCurrentTotalTime(stats); +periodTotalTime = currentTotalTime - lastTotalTime; +lastTotalTime = currentTotalTime; + +super.update(stats); + } + + private long readCurrentTotalTime(String[] stats) { +long total = 0L; +for (int i = 1; i <= 8; i++) { + total += Long.parseLong(stats[i]); +} +return total; + } + + @Override + protected long readCurrentBusyTime(String[] stats) { +return currentTotalTime - Long.parseLong(stats[4]); + } + + @VisibleForTesting Review comment: too many VisibleForTesting 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 > 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] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708676#comment-16708676 ] ASF GitHub Bot commented on SCB-1044: - wujimin commented on a change in 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#discussion_r238654827 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/NetMeter.java ## @@ -43,101 +46,48 @@ public static final Tag TAG_RECEIVE = new BasicTag(STATISTIC, "receive"); - public static final Tag TAG_SEND = new BasicTag(STATISTIC, "send"); - - private final Id id; - - private Map interfaceInfoMap = new ConcurrentHashMap<>(); - - public static class InterfaceInfo { -private final String name; - -private Id sendId; - -private Id receiveId; - -//receive bytes -private long lastRxBytes; - -//transmit bytes -private long lastTxBytes; - -// bytes per second -private double sendRate; - -private double receiveRate; - -InterfaceInfo(Id id, String name) { - this.name = name; - id = id.withTag(INTERFACE, name); - this.sendId = id.withTag(TAG_SEND); - this.receiveId = id.withTag(TAG_RECEIVE); -} - -public void update(String interfaceData, long secondInterval) { - String[] netInfo = interfaceData.trim().split("\\s+"); - long rxBytes = Long.parseLong(netInfo[0]); - long txBytes = Long.parseLong(netInfo[8]); - sendRate = (double) (txBytes - lastTxBytes) / secondInterval; - receiveRate = (double) (rxBytes - lastRxBytes) / secondInterval; - lastRxBytes = rxBytes; - lastTxBytes = txBytes; -} - -public String getName() { - return name; -} + public static final Tag TAG_PACKETS_RECEIVE = new BasicTag(STATISTIC, "receivePackets"); -public long getLastRxBytes() { - return lastRxBytes; -} + public static final Tag TAG_SEND = new BasicTag(STATISTIC, "send"); -public long getLastTxBytes() { - return lastTxBytes; -} + public static final Tag TAG_PACKETS_SEND = new BasicTag(STATISTIC, "sendPackets"); -public double getSendRate() { - return sendRate; -} + private final Id id; -public double getReceiveRate() { - return receiveRate; -} - } + private Map interfaceUsageMap = new ConcurrentHashMap<>(); public NetMeter(Id id) { this.id = id; - -// init lastRxBytes and lastTxBytes +// init lastRxBytes, lastRxPackets, lastTxBytes, lastTxPackets refreshNet(1); -for (InterfaceInfo interfaceInfo : interfaceInfoMap.values()) { - interfaceInfo.sendRate = 0; - interfaceInfo.receiveRate = 0; -} +interfaceUsageMap.values().forEach(interfaceUsage -> { + interfaceUsage.getNetStats().forEach(NetStat::clearRate); +}); } public void calcMeasurements(List measurements, long msNow, long secondInterval) { refreshNet(secondInterval); -for (InterfaceInfo interfaceInfo : interfaceInfoMap.values()) { - measurements.add(new Measurement(interfaceInfo.sendId, msNow, interfaceInfo.sendRate)); - measurements.add(new Measurement(interfaceInfo.receiveId, msNow, interfaceInfo.receiveRate)); -} +interfaceUsageMap.values().stream() Review comment: so complex, create a temp list and loop it to add to another list? 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 > 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] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708683#comment-16708683 ] ASF GitHub Bot commented on SCB-1044: - wujimin commented on a change in 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#discussion_r238655992 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/net/NetStat.java ## @@ -0,0 +1,63 @@ +/* + * 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.metrics.core.meter.os.net; + +import com.netflix.spectator.api.Id; + +public class NetStat { + private final int index; + + private Id id; + + // send/recv bytes/packets + private long lastValue; + + // Bps/pps + private double rate; + + Review comment: why always have useless empty lines? 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 > 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] [Commented] (SCB-1044) add current process CPU rate and net packets in the metrics
[ https://issues.apache.org/jira/browse/SCB-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708669#comment-16708669 ] ASF GitHub Bot commented on SCB-1044: - wujimin commented on a change in 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#discussion_r238653915 ## File path: metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/os/CpuMeter.java ## @@ -16,92 +16,59 @@ */ package org.apache.servicecomb.metrics.core.meter.os; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.List; -import org.apache.commons.io.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.servicecomb.metrics.core.meter.os.cpu.OsCpuUsage; +import org.apache.servicecomb.metrics.core.meter.os.cpu.ProcessCpuUsage; +import com.google.common.annotations.VisibleForTesting; +import com.netflix.spectator.api.BasicTag; import com.netflix.spectator.api.Id; import com.netflix.spectator.api.Measurement; +import com.netflix.spectator.api.Tag; public class CpuMeter { - private static final Logger LOGGER = LoggerFactory.getLogger(CpuMeter.class); - private double rate; + public static final Tag TAG_All = new BasicTag(OsMeter.OS_TYPE, OsMeter.OS_TYPE_ALL_CPU); - private long lastTotalTime; + public static final Tag TAG_CURRENT = new BasicTag(OsMeter.OS_TYPE, OsMeter.OS_TYPE_PROCESS_CPU); - private long lastIdleTime; + // read from /proc/stat + private OsCpuUsage allCpuUsage; - private int cpuNum; - - private Id id; + // read from /proc/{pid}/stat + private ProcessCpuUsage processCpuUsage; public CpuMeter(Id id) { -this.id = id; -this.cpuNum = Runtime.getRuntime().availableProcessors(); -refreshCpu(); -rate = 0.0; - } - - public void calcMeasurements(List measurements, long msNow) { -refreshCpu(); -measurements.add(new Measurement(id, msNow, rate)); - } - - /* - * unit : 1 jiffies = 10ms = 0.01 s - * more details : - * http://man7.org/linux/man-pages/man5/proc.5.html - * cpu 2445171 599297 353967 24490633 11242 0107802993 0 0 - * cpu usernice system idle iowait irq softirq stealstolen guest guest_nice - * 01 2 3 456 78 - * cpuTotal = user + nice + system + idle + iowait + irq + softirq + stealstolen - */ - protected void refreshCpu() { -try { - File file = new File("/proc/stat"); - //just use first line - String cpuStr = FileUtils.readLines(file, StandardCharsets.UTF_8).get(0); - String[] cpuInfo = cpuStr.trim().split("\\s+"); - long idle = Long.parseLong(cpuInfo[4]); - long total = 0L; - for (int i = 1; i <= 8; i++) { -total += Long.parseLong(cpuInfo[i]); - } - //just check, make sure it's safe - if (total != lastTotalTime) { -rate = 1.0 - (double) (idle - lastIdleTime) / (total - lastTotalTime); -rate *= cpuNum; - } - lastTotalTime = total; - lastIdleTime = idle; -} catch (IOException e) { - LOGGER.error("Failed to read current cpu info.", e); -} - } +allCpuUsage = new OsCpuUsage(id.withTag(TAG_All)); +processCpuUsage = new ProcessCpuUsage(id.withTag(TAG_CURRENT)); - public double getRate() { -return rate; +//must refresh all first +update(); +allCpuUsage.setUsage(0); +processCpuUsage.setUsage(0); } - public long getLastTotalTime() { -return lastTotalTime; + public void calcMeasurements(List measurements, long msNow) { +update(); +measurements.add(new Measurement(allCpuUsage.getId(), msNow, allCpuUsage.getUsage())); +measurements.add(new Measurement(processCpuUsage.getId(), msNow, processCpuUsage.getUsage())); } - public long getLastIdleTime() { -return lastIdleTime; + @VisibleForTesting Review comment: why so many VisibleForTesting? just check measurements is not enough? 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 > 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] [Commented] (SCB-1065) when request not contain traceId,should use provider's invocation's traceId
[ https://issues.apache.org/jira/browse/SCB-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708663#comment-16708663 ] ASF GitHub Bot commented on SCB-1065: - wujimin commented on a change in 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#discussion_r238653191 ## File path: swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/context/InvocationContext.java ## @@ -68,6 +68,22 @@ 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()) { + otherContext.putAll(context); Review comment: 1.loop context and otherContext.putIfAbsent 2.still did not process highway transport? 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 request not contain traceId,should use provider's invocation's traceId > --- > > Key: SCB-1065 > URL: https://issues.apache.org/jira/browse/SCB-1065 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis >Reporter: WeiChao >Assignee: WeiChao >Priority: Major > Fix For: java-chassis-1.2.0 > > > when request not contain traceId,should use provider's invocation's traceId -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708546#comment-16708546 ] ASF GitHub Bot commented on SCB-1047: - liubao68 closed pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013 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/test/java/org/apache/servicecomb/core/provider/consumer/TestConsumerProviderManager.java b/core/src/test/java/org/apache/servicecomb/core/provider/consumer/TestConsumerProviderManager.java index 7cee5e3fb..56bfe3897 100644 --- a/core/src/test/java/org/apache/servicecomb/core/provider/consumer/TestConsumerProviderManager.java +++ b/core/src/test/java/org/apache/servicecomb/core/provider/consumer/TestConsumerProviderManager.java @@ -94,7 +94,7 @@ public void createReferenceConfig_default() { Assert.assertEquals("app", referenceConfig.getMicroserviceVersionRule().getAppId()); Assert.assertEquals("app:ms", referenceConfig.getMicroserviceVersionRule().getMicroserviceName()); -Assert.assertEquals("0.0.0+", referenceConfig.getMicroserviceVersionRule().getVersionRule().getVersionRule()); +Assert.assertEquals("0.0.0.0+", referenceConfig.getMicroserviceVersionRule().getVersionRule().getVersionRule()); Assert.assertEquals(Const.ANY_TRANSPORT, referenceConfig.getTransport()); } @@ -107,7 +107,7 @@ public void createReferenceConfig_config() { Assert.assertEquals("app", referenceConfig.getMicroserviceVersionRule().getAppId()); Assert.assertEquals("app:ms", referenceConfig.getMicroserviceVersionRule().getMicroserviceName()); -Assert.assertEquals("1.0.0+", referenceConfig.getMicroserviceVersionRule().getVersionRule().getVersionRule()); +Assert.assertEquals("1.0.0.0+", referenceConfig.getMicroserviceVersionRule().getVersionRule().getVersionRule()); Assert.assertEquals(Const.RESTFUL, referenceConfig.getTransport()); } diff --git a/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestCompatiblePathVersionMapper.java b/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestCompatiblePathVersionMapper.java index 2cfb9fc98..871c25d41 100644 --- a/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestCompatiblePathVersionMapper.java +++ b/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestCompatiblePathVersionMapper.java @@ -35,7 +35,7 @@ public void getOrCreate() { VersionRule versionRule = mapper.getOrCreate("v1"); -Assert.assertEquals("1.0.0-2.0.0", versionRule.getVersionRule()); +Assert.assertEquals("1.0.0.0-2.0.0.0", versionRule.getVersionRule()); } @Test @@ -82,6 +82,6 @@ public void createVersionRule_tooBig() { public void createVersionRule_32767() { VersionRule versionRule = mapper.getOrCreate("v32767"); -Assert.assertEquals("32767.0.0+", versionRule.getVersionRule()); +Assert.assertEquals("32767.0.0.0+", versionRule.getVersionRule()); } } diff --git a/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestDefaultEdgeDispatcher.java b/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestDefaultEdgeDispatcher.java index 518740a82..e74f13aed 100644 --- a/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestDefaultEdgeDispatcher.java +++ b/edge/edge-core/src/test/java/org/apache/servicecomb/edge/core/TestDefaultEdgeDispatcher.java @@ -71,7 +71,7 @@ public void testOnRequest(@Mocked Router router, @Mocked Route route result = requst; requst.path(); result = "/api/testService/v1/hello"; -invocation.setVersionRule("1.0.0-2.0.0"); +invocation.setVersionRule("1.0.0.0-2.0.0.0"); invocation.init("testService", context, "/testService/v1/hello", Deencapsulation.getField(dispatcher, "httpServerFilters")); invocation.edgeInvoke(); diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java index 97b2df482..2ace55f91 100644 --- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java +++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java @@ -34,6 +34,7 @@ import org.apache.servicecomb.serviceregistry.config.ConfigurePropertyUtils; import org.apache.servicecomb.serviceregistry.config.MicroservicePropertiesLoader; import
[jira] [Commented] (SCB-1063) Improve the time cost when first time loading schema
[ https://issues.apache.org/jira/browse/SCB-1063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708543#comment-16708543 ] ASF GitHub Bot commented on SCB-1063: - liubao68 closed pull request #1021: [SCB-1063]Improve the time cost when first time loading schema URL: https://github.com/apache/servicecomb-java-chassis/pull/1021 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/definition/schema/ConsumerSchemaFactory.java b/core/src/main/java/org/apache/servicecomb/core/definition/schema/ConsumerSchemaFactory.java index c9b8ed242..aab39e973 100644 --- a/core/src/main/java/org/apache/servicecomb/core/definition/schema/ConsumerSchemaFactory.java +++ b/core/src/main/java/org/apache/servicecomb/core/definition/schema/ConsumerSchemaFactory.java @@ -37,6 +37,7 @@ // 允许consumerIntf与schemaId对应的interface原型不同,用于支持context类型的参数 // consumerIntf为null,表示原型与契约相同 public void createConsumerSchema(MicroserviceMeta microserviceMeta, Microservice microservice) { +long start = System.currentTimeMillis(); for (String schemaId : microservice.getSchemas()) { ConsumerSchemaContext context = new ConsumerSchemaContext(); context.setMicroserviceMeta(microserviceMeta); @@ -46,6 +47,9 @@ public void createConsumerSchema(MicroserviceMeta microserviceMeta, Microservice getOrCreateSchema(context); } + +LOGGER.info("Loading schema for service {} token {}", microservice.getServiceId(), +(System.currentTimeMillis() - start)); } @Override diff --git a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java index 246e8a40d..ba7c8c3c1 100644 --- a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java +++ b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java @@ -92,7 +92,9 @@ public void start(Future startFuture) { public void start(Future startFuture) { HttpClient client = vertx.createHttpClient(); client.post(port, "127.0.0.1", "/").handler(resp -> { -startFuture.complete(); +resp.bodyHandler((buffer) -> { + startFuture.complete(); +}); }).end(body); } } diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/http/ServiceRegistryClientImpl.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/http/ServiceRegistryClientImpl.java index c27ba96fe..3ee0fe818 100644 --- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/http/ServiceRegistryClientImpl.java +++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/http/ServiceRegistryClientImpl.java @@ -21,10 +21,13 @@ import java.nio.charset.Charset; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; import javax.ws.rs.core.Response.Status; @@ -60,6 +63,9 @@ import org.slf4j.LoggerFactory; import com.google.common.annotations.VisibleForTesting; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; import io.netty.handler.codec.http.HttpStatusClass; import io.vertx.core.Handler; @@ -79,6 +85,18 @@ public ServiceRegistryClientImpl(IpPortManager ipPortManager) { this.ipPortManager = ipPortManager; } + private LoadingCache> schemaCache = CacheBuilder.newBuilder() + .expireAfterAccess(60, TimeUnit.SECONDS).build(new CacheLoader>() { +public Map load(String key) { + Holder> result = getSchemas(key, true, true); + Map schemas = new HashMap<>(); + if (result.getStatusCode() == Status.OK.getStatusCode() ) { +result.value.stream().forEach(r -> schemas.put(r.getSchemaId(), r.getSchema())); + } + return schemas; +} + }); + @Override public void init() { } @@ -350,6 +368,16 @@ public String getSchema(String microserviceId, String schemaId) { } private String doGetSchema(String microserviceId, String schemaId, boolean global) { +try { + // avoid query too many times of schema when first time loading + String cachedSchema = schemaCache.get(microserviceId).get(schemaId); + if (cachedSchema != null)
[jira] [Commented] (SCB-1065) when request not contain traceId,should use provider's invocation's traceId
[ https://issues.apache.org/jira/browse/SCB-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708399#comment-16708399 ] ASF GitHub Bot commented on SCB-1065: - wujimin commented on a change in 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#discussion_r238569551 ## File path: 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.addContext(cseContext); Review comment: highway have the same problem we can add a new method in invocation: mergeContext 1.if new context have more items, then addAll to new context, and replace old context 2.if new context have less items, then allAll to old context directly. 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 request not contain traceId,should use provider's invocation's traceId > --- > > Key: SCB-1065 > URL: https://issues.apache.org/jira/browse/SCB-1065 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis >Reporter: WeiChao >Assignee: WeiChao >Priority: Major > Fix For: java-chassis-1.2.0 > > > when request not contain traceId,should use provider's invocation's traceId -- 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
[ https://issues.apache.org/jira/browse/SCB-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708386#comment-16708386 ] ASF GitHub Bot commented on SCB-1065: - weichao666 opened a new 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 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` 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 > when request not contain traceId,should use provider's invocation's traceId > --- > > Key: SCB-1065 > URL: https://issues.apache.org/jira/browse/SCB-1065 > Project: Apache ServiceComb > Issue Type: Bug > Components: Java-Chassis >Reporter: WeiChao >Assignee: WeiChao >Priority: Major > Fix For: java-chassis-1.2.0 > > > when request not contain traceId,should use provider's invocation's traceId -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (SCB-1065) when request not contain traceId,should use provider's invocation's traceId
WeiChao created SCB-1065: Summary: when request not contain traceId,should use provider's invocation's traceId Key: SCB-1065 URL: https://issues.apache.org/jira/browse/SCB-1065 Project: Apache ServiceComb Issue Type: Bug Components: Java-Chassis Reporter: WeiChao Assignee: WeiChao Fix For: java-chassis-1.2.0 when request not contain traceId,should use provider's invocation's traceId -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708353#comment-16708353 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238560814 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java ## @@ -53,8 +54,13 @@ private Microservice createMicroserviceFromDefinition(Configuration configuratio microservice.setServiceName(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, DEFAULT_MICROSERVICE_NAME)); microservice.setAppId(configuration.getString(CONFIG_APPLICATION_ID_KEY, DEFAULT_APPLICATION_ID)); - microservice.setVersion(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, -DEFAULT_MICROSERVICE_VERSION)); +String version = configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, +DEFAULT_MICROSERVICE_VERSION); +//check version format +if (!Version.checkVersion(version)) { Review comment: ok, I see. 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708352#comment-16708352 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238560805 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/version/Version.java ## @@ -74,34 +78,52 @@ private short parseNumber(String name, String allVersion, String version) { return value; } - public Version(short major, short minor, short patch) { + public Version(short major, short minor, short patch, short build) { this.major = major; this.minor = minor; this.patch = patch; +this.build = build; this.version = combineStringVersion(); this.numberVersion = combineVersion(); } private String combineStringVersion() { -return major + "." + minor + "." + patch; +StringBuilder stringBuilder = new StringBuilder(); +stringBuilder.append(major) +.append(".") +.append(minor) +.append(".") +.append(patch) +.append(".") +.append(build); +return stringBuilder.toString(); } + // 1.0.0 equals 1.0.0.0 private long combineVersion() { -return (long) major << 32 | (long) minor << 16 | (long) patch; +return (long) major << 48 | (long) minor << 32 | (long) patch << 16 | (long) build; } + @VisibleForTesting Review comment: ok 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708351#comment-16708351 ] ASF GitHub Bot commented on SCB-1047: - wujimin commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238560231 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java ## @@ -53,8 +54,13 @@ private Microservice createMicroserviceFromDefinition(Configuration configuratio microservice.setServiceName(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, DEFAULT_MICROSERVICE_NAME)); microservice.setAppId(configuration.getString(CONFIG_APPLICATION_ID_KEY, DEFAULT_APPLICATION_ID)); - microservice.setVersion(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, -DEFAULT_MICROSERVICE_VERSION)); +String version = configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, +DEFAULT_MICROSERVICE_VERSION); +//check version format +if (!Version.checkVersion(version)) { Review comment: do you want to express version format check logic by two different way? 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708350#comment-16708350 ] ASF GitHub Bot commented on SCB-1047: - wujimin commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238560059 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java ## @@ -53,8 +54,13 @@ private Microservice createMicroserviceFromDefinition(Configuration configuratio microservice.setServiceName(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, DEFAULT_MICROSERVICE_NAME)); microservice.setAppId(configuration.getString(CONFIG_APPLICATION_ID_KEY, DEFAULT_APPLICATION_ID)); - microservice.setVersion(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, -DEFAULT_MICROSERVICE_VERSION)); +String version = configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, +DEFAULT_MICROSERVICE_VERSION); +//check version format +if (!Version.checkVersion(version)) { Review comment: but constrcut a version will got the detail of the wrong format message 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708348#comment-16708348 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238559568 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/api/registry/MicroserviceFactory.java ## @@ -53,8 +54,13 @@ private Microservice createMicroserviceFromDefinition(Configuration configuratio microservice.setServiceName(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, DEFAULT_MICROSERVICE_NAME)); microservice.setAppId(configuration.getString(CONFIG_APPLICATION_ID_KEY, DEFAULT_APPLICATION_ID)); - microservice.setVersion(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, -DEFAULT_MICROSERVICE_VERSION)); +String version = configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, +DEFAULT_MICROSERVICE_VERSION); +//check version format +if (!Version.checkVersion(version)) { Review comment: Maybe just check format is better ? the new Version instance will never used 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708345#comment-16708345 ] ASF GitHub Bot commented on SCB-1047: - wujimin commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238559157 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/version/Version.java ## @@ -74,34 +78,52 @@ private short parseNumber(String name, String allVersion, String version) { return value; } - public Version(short major, short minor, short patch) { + public Version(short major, short minor, short patch, short build) { this.major = major; this.minor = minor; this.patch = patch; +this.build = build; this.version = combineStringVersion(); this.numberVersion = combineVersion(); } private String combineStringVersion() { -return major + "." + minor + "." + patch; +StringBuilder stringBuilder = new StringBuilder(); +stringBuilder.append(major) +.append(".") +.append(minor) +.append(".") +.append(patch) +.append(".") +.append(build); +return stringBuilder.toString(); } + // 1.0.0 equals 1.0.0.0 private long combineVersion() { -return (long) major << 32 | (long) minor << 16 | (long) patch; +return (long) major << 48 | (long) minor << 32 | (long) patch << 16 | (long) build; } + @VisibleForTesting Review comment: it's a public class, and have normal getter/setter? why only can be used in junit? 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708344#comment-16708344 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238558961 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/version/VersionRuleUtils.java ## @@ -54,7 +54,6 @@ public static VersionRule create(String strVersionRule) { return versionRule; } } - -throw new IllegalStateException("never run to here"); +throw new IllegalStateException("config service_description.version is invalid "); Review comment: I mistake version and versionRule at first. And forget to delete 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708342#comment-16708342 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238558728 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/version/Version.java ## @@ -74,34 +78,52 @@ private short parseNumber(String name, String allVersion, String version) { return value; } - public Version(short major, short minor, short patch) { + public Version(short major, short minor, short patch, short build) { this.major = major; this.minor = minor; this.patch = patch; +this.build = build; this.version = combineStringVersion(); this.numberVersion = combineVersion(); } private String combineStringVersion() { -return major + "." + minor + "." + patch; +StringBuilder stringBuilder = new StringBuilder(); +stringBuilder.append(major) +.append(".") +.append(minor) +.append(".") +.append(patch) +.append(".") +.append(build); +return stringBuilder.toString(); } + // 1.0.0 equals 1.0.0.0 private long combineVersion() { -return (long) major << 32 | (long) minor << 16 | (long) patch; +return (long) major << 48 | (long) minor << 32 | (long) patch << 16 | (long) build; } + @VisibleForTesting Review comment: it's only used in Junit 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708341#comment-16708341 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238558539 ## File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/version/Version.java ## @@ -21,37 +21,41 @@ import org.apache.commons.lang.ArrayUtils; +import com.google.common.annotations.VisibleForTesting; + // short version is enough public class Version implements Comparable { - private static final String[] ZERO = new String[] {"0", "0", "0"}; + private static final String[] ZERO = new String[] {"0", "0", "0", "0"}; private final short major; private final short minor; private final short patch; + private final short build; + private final String version; private final long numberVersion; // 1 // 1.0 // 1.0.0 + // 1.0.0.0 public Version(String version) { Objects.requireNonNull(version); String[] versions = version.split("\\.", -1); -if (versions.length > 3) { +if (versions.length > 4) { throw new IllegalStateException(String.format("Invalid version \"%s\".", version)); } -if (versions.length < 3) { - versions = (String[]) ArrayUtils.addAll(versions, ZERO); -} +versions = (String[]) ArrayUtils.addAll(versions, ZERO); Review comment: ok 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708340#comment-16708340 ] ASF GitHub Bot commented on SCB-1047: - heyile commented on a change in pull request #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#discussion_r238558326 ## File path: service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestRemoteServiceRegistry.java ## @@ -141,6 +142,13 @@ public void onPullMicroserviceVersionsInstancesEvent(@Injectable ServiceRegistry } }.getMockInstance(); +new MockUp() { + @Mock + boolean checkVersion(String version){ Review comment: as now when version is invalid, we can not registe provider 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 > 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] [Commented] (SCB-1047) microservice.yaml service_description.version support format xxx.xx.xxx.xxx
[ https://issues.apache.org/jira/browse/SCB-1047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16708339#comment-16708339 ] ASF GitHub Bot commented on SCB-1047: - coveralls edited a comment on issue #1013: [SCB-1047]microservice.yaml service_description.version support form… URL: https://github.com/apache/servicecomb-java-chassis/pull/1013#issuecomment-441953809 [![Coverage Status](https://coveralls.io/builds/20437657/badge)](https://coveralls.io/builds/20437657) Coverage increased (+0.004%) to 86.716% when pulling **da29134e85c82c0260c62a82d54457fe908e37a5 on heyile:versionFour** into **2bb90ab5d7e1d333141e07db23f02569307d6ef1 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 > 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)