This is an automated email from the ASF dual-hosted git repository.
zhangwei24 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 63d63ed Add feign loadbalancer case for
spring-cloud-feign-2.x-scenario plugin. (#5700)
63d63ed is described below
commit 63d63ed7f5737fa554f3cc40ccd788a855ac756c
Author: zifeihan <[email protected]>
AuthorDate: Wed Oct 21 07:58:09 2020 +0800
Add feign loadbalancer case for spring-cloud-feign-2.x-scenario plugin.
(#5700)
---
.../config/expectedData.yaml | 430 ++++++++++++---------
.../skywalking/apm/testcase/feign/Application.java | 11 +
.../apm/testcase/feign/controller/RestRequest.java | 9 +-
3 files changed, 263 insertions(+), 187 deletions(-)
diff --git
a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml
b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml
index 6d5b26a..263371e 100644
---
a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml
+++
b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml
@@ -14,188 +14,248 @@
# See the License for the specific language governing permissions and
# limitations under the License.
segmentItems:
-- serviceName: spring-cloud-feign-2.x-scenario
- segmentSize: ge 5
- segments:
- - segmentId: not null
- spans:
- - operationName: /spring-cloud-feign-2.x-scenario/case/healthCheck
- operationId: 0
- parentSpanId: -1
- spanId: 0
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Entry
- peer: ''
- tags:
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/case/healthCheck'}
- - {key: http.method, value: HEAD}
- skipAnalysis: 'false'
- - segmentId: not null
- spans:
- - operationName: /spring-cloud-feign-2.x-scenario/create/
- operationId: 0
- parentSpanId: -1
- spanId: 0
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Entry
- peer: ''
- tags:
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/create/'}
- - {key: http.method, value: POST}
- refs:
- - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
- networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId:
1,
- parentTraceSegmentId: not null, parentServiceInstance: not null,
parentService: spring-cloud-feign-2.x-scenario,
- traceId: not null}
- skipAnalysis: 'false'
- - segmentId: not null
- spans:
- - operationName: /spring-cloud-feign-2.x-scenario/create/
- operationId: 0
- parentSpanId: 0
- spanId: 1
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Exit
- peer: localhost:8080
- tags:
- - {key: http.method, value: POST}
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/create/'}
- skipAnalysis: 'false'
- - operationName: /spring-cloud-feign-2.x-scenario/get/{id}
- operationId: 0
- parentSpanId: 0
- spanId: 2
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Exit
- peer: localhost:8080
- tags:
- - {key: http.method, value: GET}
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/get/1'}
- skipAnalysis: 'false'
- - operationName: /spring-cloud-feign-2.x-scenario/update/{id}
- operationId: 0
- parentSpanId: 0
- spanId: 3
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Exit
- peer: localhost:8080
- tags:
- - {key: http.method, value: PUT}
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/update/1'}
- skipAnalysis: 'false'
- - operationName: /spring-cloud-feign-2.x-scenario/delete/{id}
- operationId: 0
- parentSpanId: 0
- spanId: 4
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Exit
- peer: localhost:8080
- tags:
- - {key: http.method, value: DELETE}
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/delete/1'}
- skipAnalysis: 'false'
- - operationName:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario
- operationId: 0
- parentSpanId: -1
- spanId: 0
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Entry
- peer: ''
- tags:
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario'}
- - {key: http.method, value: GET}
- skipAnalysis: 'false'
- - segmentId: not null
- spans:
- - operationName: /spring-cloud-feign-2.x-scenario/get/1
- operationId: 0
- parentSpanId: -1
- spanId: 0
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Entry
- peer: ''
- tags:
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/get/1'}
- - {key: http.method, value: GET}
- refs:
- - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
- networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId:
2,
- parentTraceSegmentId: not null, parentServiceInstance: not null,
parentService: spring-cloud-feign-2.x-scenario,
- traceId: not null}
- skipAnalysis: 'false'
- - segmentId: not null
- spans:
- - operationName: /spring-cloud-feign-2.x-scenario/update/1
- operationId: 0
- parentSpanId: -1
- spanId: 0
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Entry
- peer: ''
- tags:
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/update/1'}
- - {key: http.method, value: PUT}
- refs:
- - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
- networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId:
3,
- parentTraceSegmentId: not null, parentServiceInstance: not null,
parentService: spring-cloud-feign-2.x-scenario,
- traceId: not null}
- skipAnalysis: 'false'
- - segmentId: not null
- spans:
- - operationName: /spring-cloud-feign-2.x-scenario/delete/1
- operationId: 0
- parentSpanId: -1
- spanId: 0
- spanLayer: Http
- startTime: nq 0
- endTime: nq 0
- componentId: not null
- isError: false
- spanType: Entry
- peer: ''
- tags:
- - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/delete/1'}
- - {key: http.method, value: DELETE}
- refs:
- - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
- networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId:
4,
- parentTraceSegmentId: not null, parentServiceInstance: not null,
parentService: spring-cloud-feign-2.x-scenario,
- traceId: not null}
- skipAnalysis: 'false'
+ - serviceName: spring-cloud-feign-2.x-scenario
+ segmentSize: ge 6
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /spring-cloud-feign-2.x-scenario/case/healthCheck
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/case/healthCheck'}
+ - {key: http.method, value: HEAD}
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /spring-cloud-feign-2.x-scenario/create/
+ operationId: 0
+ parentSpanId: 1
+ spanId: 2
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ tags:
+ - {key: http.method, value: POST}
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/create/'}
+ skipAnalysis: 'false'
+ - operationName: Balancer/spring-cloud-feign-2.x-scenario/create/
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Local
+ peer: ''
+ tags:
+ - {key: http.method, value: POST}
+ - {key: url, value:
'http://spring-cloud-feign-2.x-scenario/spring-cloud-feign-2.x-scenario/create/'}
+ skipAnalysis: 'false'
+ - operationName: /spring-cloud-feign-2.x-scenario/get/1
+ operationId: 0
+ parentSpanId: 3
+ spanId: 4
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ tags:
+ - {key: http.method, value: GET}
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/get/1'}
+ skipAnalysis: 'false'
+ - operationName: Balancer/spring-cloud-feign-2.x-scenario/get/{id}
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Local
+ peer: ''
+ tags:
+ - {key: http.method, value: GET}
+ - {key: url, value:
'http://spring-cloud-feign-2.x-scenario/spring-cloud-feign-2.x-scenario/get/1'}
+ skipAnalysis: 'false'
+ - operationName: /spring-cloud-feign-2.x-scenario/update/1
+ operationId: 0
+ parentSpanId: 5
+ spanId: 6
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ tags:
+ - {key: http.method, value: PUT}
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/update/1'}
+ skipAnalysis: 'false'
+ - operationName: Balancer/spring-cloud-feign-2.x-scenario/update/{id}
+ operationId: 0
+ parentSpanId: 0
+ spanId: 5
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Local
+ peer: ''
+ tags:
+ - {key: http.method, value: PUT}
+ - {key: url, value:
'http://spring-cloud-feign-2.x-scenario/spring-cloud-feign-2.x-scenario/update/1'}
+ skipAnalysis: 'false'
+ - operationName: /spring-cloud-feign-2.x-scenario/delete/1
+ operationId: 0
+ parentSpanId: 7
+ spanId: 8
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ tags:
+ - {key: http.method, value: DELETE}
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/delete/1'}
+ skipAnalysis: 'false'
+ - operationName: Balancer/spring-cloud-feign-2.x-scenario/delete/{id}
+ operationId: 0
+ parentSpanId: 0
+ spanId: 7
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Local
+ peer: ''
+ tags:
+ - {key: http.method, value: DELETE}
+ - {key: url, value:
'http://spring-cloud-feign-2.x-scenario/spring-cloud-feign-2.x-scenario/delete/1'}
+ skipAnalysis: 'false'
+ - operationName:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario'}
+ - {key: http.method, value: GET}
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /spring-cloud-feign-2.x-scenario/create/
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/create/'}
+ - {key: http.method, value: POST}
+ refs:
+ - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
+ networkAddress: 'localhost:8080', refType: CrossProcess,
parentSpanId: 2,
+ parentTraceSegmentId: not null, parentServiceInstance: not
null, parentService: spring-cloud-feign-2.x-scenario,
+ traceId: not null}
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /spring-cloud-feign-2.x-scenario/get/1
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/get/1'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
+ networkAddress: 'localhost:8080', refType: CrossProcess,
parentSpanId: 4,
+ parentTraceSegmentId: not null, parentServiceInstance: not
null, parentService: spring-cloud-feign-2.x-scenario,
+ traceId: not null}
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /spring-cloud-feign-2.x-scenario/update/1
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/update/1'}
+ - {key: http.method, value: PUT}
+ refs:
+ - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
+ networkAddress: 'localhost:8080', refType: CrossProcess,
parentSpanId: 6,
+ parentTraceSegmentId: not null, parentServiceInstance: not
null, parentService: spring-cloud-feign-2.x-scenario,
+ traceId: not null}
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /spring-cloud-feign-2.x-scenario/delete/1
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: not null
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value:
'http://localhost:8080/spring-cloud-feign-2.x-scenario/delete/1'}
+ - {key: http.method, value: DELETE}
+ refs:
+ - {parentEndpoint:
/spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario,
+ networkAddress: 'localhost:8080', refType: CrossProcess,
parentSpanId: 8,
+ parentTraceSegmentId: not null, parentServiceInstance: not
null, parentService: spring-cloud-feign-2.x-scenario,
+ traceId: not null}
+ skipAnalysis: 'false'
diff --git
a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java
b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java
index e69a36a..bace8aa 100644
---
a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java
+++
b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java
@@ -18,9 +18,13 @@
package org.apache.skywalking.apm.testcase.feign;
+import com.netflix.loadbalancer.DynamicServerListLoadBalancer;
+import com.netflix.loadbalancer.ILoadBalancer;
+import com.netflix.loadbalancer.Server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableFeignClients
@@ -33,4 +37,11 @@ public class Application {
// Never do this
}
}
+
+ @Bean
+ public ILoadBalancer loadBalancer() {
+ DynamicServerListLoadBalancer<Server>
serverDynamicServerListLoadBalancer = new DynamicServerListLoadBalancer<>();
+ serverDynamicServerListLoadBalancer.addServer(new Server("localhost",
8080));
+ return serverDynamicServerListLoadBalancer;
+ }
}
diff --git
a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java
b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java
index b3d9a2f..c4721c2 100644
---
a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java
+++
b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java
@@ -21,9 +21,14 @@ package org.apache.skywalking.apm.testcase.feign.controller;
import org.apache.skywalking.apm.testcase.feign.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
-@FeignClient(value = "spring-cloud-feign-2.x-scenario", url =
"localhost:8080", path = "/spring-cloud-feign-2.x-scenario")
+@FeignClient(value = "spring-cloud-feign-2.x-scenario", path =
"/spring-cloud-feign-2.x-scenario")
public interface RestRequest {
@GetMapping("/get/{id}")