Add feign loadbalancer case for spring-cloud-feign-1.x-scenario plugin. (#5711)

This commit is contained in:
zifeihan 2020-10-22 14:03:28 +08:00 committed by GitHub
parent c2141978d1
commit e1619495c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 202 additions and 150 deletions

View File

@ -14,77 +14,92 @@
# See the License for the specific language governing permissions and
# limitations under the License.
segmentItems:
- serviceName: spring-cloud-feign-1.1.x-scenario
segmentSize: ge 2
segments:
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.1.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-1.1.x-scenario/case/healthCheck'}
- {key: http.method, value: HEAD}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.1.x-scenario/get
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-1.1.x-scenario/get'}
- {key: http.method, value: GET}
refs:
- {parentEndpoint: /spring-cloud-feign-1.1.x-scenario/case/spring-cloud-feign-1.1.x-scenario,
networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: spring-cloud-feign-1.1.x-scenario,
traceId: not null}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.1.x-scenario/get
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: GET}
- {key: url, value: 'http://localhost:8080/spring-cloud-feign-1.1.x-scenario/get'}
skipAnalysis: 'false'
- operationName: /spring-cloud-feign-1.1.x-scenario/case/spring-cloud-feign-1.1.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-1.1.x-scenario/case/spring-cloud-feign-1.1.x-scenario'}
- {key: http.method, value: GET}
skipAnalysis: 'false'
- serviceName: spring-cloud-feign-1.1.x-scenario
segmentSize: ge 2
segments:
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.1.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-1.1.x-scenario/case/healthCheck'}
- {key: http.method, value: HEAD}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.1.x-scenario/get
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-1.1.x-scenario/get'}
- {key: http.method, value: GET}
refs:
- {parentEndpoint: /spring-cloud-feign-1.1.x-scenario/case/spring-cloud-feign-1.1.x-scenario,
networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: not null,
parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: spring-cloud-feign-1.1.x-scenario,
traceId: not null}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.1.x-scenario/get
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: GET}
- {key: url, value: 'http://localhost:8080/spring-cloud-feign-1.1.x-scenario/get'}
skipAnalysis: 'false'
- operationName: Balancer/spring-cloud-feign-1.1.x-scenario/get
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: GET}
- {key: url, value: 'http://spring-cloud-feign-1.1.x-scenario/spring-cloud-feign-1.1.x-scenario/get'}
skipAnalysis: 'false'
- operationName: /spring-cloud-feign-1.1.x-scenario/case/spring-cloud-feign-1.1.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-1.1.x-scenario/case/spring-cloud-feign-1.1.x-scenario'}
- {key: http.method, value: GET}
skipAnalysis: 'false'

View File

@ -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.netflix.feign.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;
}
}

View File

@ -22,7 +22,7 @@ import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient(value = "spring-cloud-feign-1.1.x-scenario", url = "localhost:8080/spring-cloud-feign-1.1.x-scenario")
@FeignClient(value = "spring-cloud-feign-1.1.x-scenario", path = "/spring-cloud-feign-1.1.x-scenario")
public interface RestRequest {
@RequestMapping(value = "/get", method = RequestMethod.GET)

View File

@ -14,77 +14,92 @@
# See the License for the specific language governing permissions and
# limitations under the License.
segmentItems:
- serviceName: spring-cloud-feign-1.2.x-scenario
segmentSize: ge 2
segments:
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.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-1.2.x-scenario/case/healthCheck'}
- {key: http.method, value: HEAD}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.2.x-scenario/get
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-1.2.x-scenario/get'}
- {key: http.method, value: GET}
refs:
- {parentEndpoint: /spring-cloud-feign-1.2.x-scenario/case/spring-cloud-feign-1.2.x-scenario,
networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1,
parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: spring-cloud-feign-1.2.x-scenario,
traceId: not null}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.2.x-scenario/get
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: GET}
- {key: url, value: 'http://localhost:8080/spring-cloud-feign-1.2.x-scenario/get'}
skipAnalysis: 'false'
- operationName: /spring-cloud-feign-1.2.x-scenario/case/spring-cloud-feign-1.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-1.2.x-scenario/case/spring-cloud-feign-1.2.x-scenario'}
- {key: http.method, value: GET}
skipAnalysis: 'false'
- serviceName: spring-cloud-feign-1.2.x-scenario
segmentSize: ge 2
segments:
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.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-1.2.x-scenario/case/healthCheck'}
- {key: http.method, value: HEAD}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.2.x-scenario/get
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-1.2.x-scenario/get'}
- {key: http.method, value: GET}
refs:
- {parentEndpoint: /spring-cloud-feign-1.2.x-scenario/case/spring-cloud-feign-1.2.x-scenario,
networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: not null,
parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: spring-cloud-feign-1.2.x-scenario,
traceId: not null}
skipAnalysis: 'false'
- segmentId: not null
spans:
- operationName: /spring-cloud-feign-1.2.x-scenario/get
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: GET}
- {key: url, value: 'http://localhost:8080/spring-cloud-feign-1.2.x-scenario/get'}
skipAnalysis: 'false'
- operationName: Balancer/spring-cloud-feign-1.2.x-scenario/get
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: GET}
- {key: url, value: 'http://spring-cloud-feign-1.2.x-scenario/spring-cloud-feign-1.2.x-scenario/get'}
skipAnalysis: 'false'
- operationName: /spring-cloud-feign-1.2.x-scenario/case/spring-cloud-feign-1.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-1.2.x-scenario/case/spring-cloud-feign-1.2.x-scenario'}
- {key: http.method, value: GET}
skipAnalysis: 'false'

View File

@ -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.netflix.feign.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;
}
}

View File

@ -22,7 +22,7 @@ import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient(value = "spring-cloud-feign-1.2.x-scenario", url = "localhost:8080/spring-cloud-feign-1.2.x-scenario")
@FeignClient(value = "spring-cloud-feign-1.2.x-scenario", path = "/spring-cloud-feign-1.2.x-scenario")
public interface RestRequest {
@RequestMapping(value = "/get", method = RequestMethod.GET)