[test/plugin] immigrate test hystrix scenario. (#3887)
* [test/plugin] immigrate test hystrix scenario. * change package name. * add start script.
This commit is contained in:
parent
7e889d3471
commit
a2dce716db
|
|
@ -67,7 +67,7 @@ pipeline {
|
||||||
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build'
|
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test Cases Report (140)') {
|
stage('Test Cases Report (160)') {
|
||||||
steps {
|
steps {
|
||||||
echo "Test Cases Report"
|
echo "Test Cases Report"
|
||||||
}
|
}
|
||||||
|
|
@ -82,6 +82,12 @@ pipeline {
|
||||||
parallel {
|
parallel {
|
||||||
stage('Group1') {
|
stage('Group1') {
|
||||||
stages {
|
stages {
|
||||||
|
stage('hystrix 1.4.20-1.5.12 (20)') {
|
||||||
|
steps {
|
||||||
|
sh 'bash test/plugin/run.sh hystrix-scenario'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('postgresql 9.2.x-9.4.x (36)') {
|
stage('postgresql 9.2.x-9.4.x (36)') {
|
||||||
steps {
|
steps {
|
||||||
sh 'bash test/plugin/run.sh postgresql-scenario'
|
sh 'bash test/plugin/run.sh postgresql-scenario'
|
||||||
|
|
|
||||||
|
|
@ -648,9 +648,10 @@ elasticsearch 5.x | 3 | 142.15
|
||||||
|
|
||||||
|
|
||||||
### Workload 3
|
### Workload 3
|
||||||
#### Group 1 (2291.912s)
|
#### Group 1 (3090.912s)
|
||||||
scenario name | versions | elapsed time (sec)
|
scenario name | versions | elapsed time (sec)
|
||||||
---|---|---
|
---|---|---
|
||||||
|
hystrix-scenario | 20 | 799.00
|
||||||
postgresql 9.2.x-9.4.x | 36 | 1243.03
|
postgresql 9.2.x-9.4.x | 36 | 1243.03
|
||||||
sofarpc 5.4.0-5.6.2 | 23 | 817.77
|
sofarpc 5.4.0-5.6.2 | 23 | 817.77
|
||||||
spring 3.0.x | 8 | 231.11
|
spring 3.0.x | 8 | 231.11
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
home="$(cd "$(dirname $0)"; pwd)"
|
||||||
|
|
||||||
|
java -jar ${agent_opts} ${home}/../libs/hystrix-scenario.jar &
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
# 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.
|
||||||
|
registryItems:
|
||||||
|
applications:
|
||||||
|
- {hystrix-scenario: 2}
|
||||||
|
instances:
|
||||||
|
- {hystrix-scenario: 1}
|
||||||
|
operationNames:
|
||||||
|
- hystrix-scenario: [/case/hystrix-scenario]
|
||||||
|
heartbeat: []
|
||||||
|
segmentItems:
|
||||||
|
- applicationCode: hystrix-scenario
|
||||||
|
segmentSize: ge 1
|
||||||
|
segments:
|
||||||
|
- segmentId: not null
|
||||||
|
spans:
|
||||||
|
- operationName: Hystrix/TestACommand/Execution
|
||||||
|
operationId: 0
|
||||||
|
parentSpanId: -1
|
||||||
|
spanId: 0
|
||||||
|
spanLayer: Unknown
|
||||||
|
startTime: nq 0
|
||||||
|
endTime: nq 0
|
||||||
|
componentId: 29
|
||||||
|
componentName: ''
|
||||||
|
isError: false
|
||||||
|
spanType: Local
|
||||||
|
peer: ''
|
||||||
|
peerId: 0
|
||||||
|
logs:
|
||||||
|
- logEvent:
|
||||||
|
- {key: event, value: error}
|
||||||
|
- {key: error.kind, value: java.lang.InterruptedException}
|
||||||
|
- {key: message, value: not null}
|
||||||
|
- {key: stack, value: not null}
|
||||||
|
refs:
|
||||||
|
- {parentEndpointId: 0, parentEndpoint: /case/hystrix-scenario, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: '${hystrix-scenario[2]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0 }
|
||||||
|
- segmentId: not null
|
||||||
|
spans:
|
||||||
|
- operationName: Hystrix/TestACommand/Fallback
|
||||||
|
operationId: 0
|
||||||
|
parentSpanId: -1
|
||||||
|
spanId: 0
|
||||||
|
spanLayer: Unknown
|
||||||
|
startTime: nq 0
|
||||||
|
endTime: nq 0
|
||||||
|
componentId: 29
|
||||||
|
componentName: ''
|
||||||
|
isError: false
|
||||||
|
spanType: Local
|
||||||
|
peer: ''
|
||||||
|
peerId: 0
|
||||||
|
refs:
|
||||||
|
- {parentEndpointId: 0, parentEndpoint: Hystrix/TestACommand/Execution, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: '${hystrix-scenario[0]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0}
|
||||||
|
- segmentId: not null
|
||||||
|
spans:
|
||||||
|
- operationName: Hystrix/TestBCommand/Execution
|
||||||
|
operationId: 0
|
||||||
|
parentSpanId: 0
|
||||||
|
spanId: 1
|
||||||
|
spanLayer: Unknown
|
||||||
|
startTime: nq 0
|
||||||
|
endTime: nq 0
|
||||||
|
componentId: 29
|
||||||
|
componentName: ''
|
||||||
|
isError: false
|
||||||
|
spanType: Local
|
||||||
|
peer: ''
|
||||||
|
peerId: 0
|
||||||
|
- operationName: /case/hystrix-scenario
|
||||||
|
operationId: 0
|
||||||
|
parentSpanId: -1
|
||||||
|
spanId: 0
|
||||||
|
spanLayer: Http
|
||||||
|
startTime: nq 0
|
||||||
|
endTime: nq 0
|
||||||
|
componentId: 14
|
||||||
|
componentName: ''
|
||||||
|
isError: false
|
||||||
|
spanType: Entry
|
||||||
|
peer: ''
|
||||||
|
peerId: 0
|
||||||
|
tags:
|
||||||
|
- {key: url, value: 'http://localhost:8080/hystrix-scenario/case/hystrix-scenario'}
|
||||||
|
- {key: http.method, value: GET}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
type: jvm
|
||||||
|
entryService: http://localhost:8080/hystrix-scenario/case/hystrix-scenario
|
||||||
|
healthCheck: http://localhost:8080/hystrix-scenario/case/healthCheck
|
||||||
|
startScript: ./bin/startup.sh
|
||||||
|
framework: hystrix-scenario
|
||||||
|
environment:
|
||||||
|
dependencies:
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
~
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<groupId>org.apache.skywalking.apm.testcase</groupId>
|
||||||
|
<artifactId>hystrix-scenario</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<compiler.version>1.8</compiler.version>
|
||||||
|
|
||||||
|
<test.framework.version>1.4.20</test.framework.version>
|
||||||
|
<spring-boot-version>2.1.6.RELEASE</spring-boot-version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<name>skywalking-hystrix-scenario</name>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot-version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>jul-to-slf4j</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.netflix.hystrix</groupId>
|
||||||
|
<artifactId>hystrix-core</artifactId>
|
||||||
|
<version>${test.framework.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>hystrix-scenario</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${compiler.version}</source>
|
||||||
|
<target>${compiler.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>assemble</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
<outputDirectory>./target/</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
~
|
||||||
|
-->
|
||||||
|
<assembly
|
||||||
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<directory>./bin</directory>
|
||||||
|
<fileMode>0775</fileMode>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
|
||||||
|
<files>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/hystrix-scenario.jar</source>
|
||||||
|
<outputDirectory>./libs</outputDirectory>
|
||||||
|
<fileMode>0775</fileMode>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
</assembly>
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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 test.apache.skywalking.apm.testcase.hystrix;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class Application {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
SpringApplication.run(Application.class, args);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Never do this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* 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 test.apache.skywalking.apm.testcase.hystrix.controller;
|
||||||
|
|
||||||
|
import com.netflix.hystrix.HystrixCommand;
|
||||||
|
import com.netflix.hystrix.HystrixInvokable;
|
||||||
|
import com.netflix.hystrix.strategy.HystrixPlugins;
|
||||||
|
import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/case")
|
||||||
|
public class CaseController {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(CaseController.class);
|
||||||
|
|
||||||
|
private static final String SUCCESS = "Success";
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void setUp() {
|
||||||
|
HystrixPlugins.getInstance().registerCommandExecutionHook(new HystrixCommandExecutionHook() {
|
||||||
|
@Override public <T> void onStart(HystrixInvokable<T> commandInstance) {
|
||||||
|
logger.info("[hookA] onStart: " + Thread.currentThread().getId());
|
||||||
|
super.onStart(commandInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public <T> void onExecutionStart(HystrixInvokable<T> commandInstance) {
|
||||||
|
logger.info("[hookA] onExecutionStart: " + Thread.currentThread().getId());
|
||||||
|
super.onExecutionStart(commandInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public <T> void onExecutionSuccess(HystrixInvokable<T> commandInstance) {
|
||||||
|
logger.info("[hookA] onExecutionSuccess: " + Thread.currentThread().getId());
|
||||||
|
super.onExecutionSuccess(commandInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public <T> Exception onExecutionError(HystrixInvokable<T> commandInstance, Exception e) {
|
||||||
|
logger.info("[hookA] onExecutionError: " + Thread.currentThread().getId());
|
||||||
|
return super.onExecutionError(commandInstance, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public <T> Exception onRunError(HystrixCommand<T> commandInstance, Exception e) {
|
||||||
|
logger.info("[hookA] onRunError: " + Thread.currentThread().getId());
|
||||||
|
return super.onRunError(commandInstance, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/hystrix-scenario")
|
||||||
|
@ResponseBody
|
||||||
|
public String testcase() throws InterruptedException, ExecutionException {
|
||||||
|
List<Future<String>> fs = new ArrayList<Future<String>>();
|
||||||
|
fs.add(new TestBCommand("World").queue());
|
||||||
|
logger.info(new TestACommand("World").execute());
|
||||||
|
for (Future<String> f : fs) {
|
||||||
|
logger.info(f.get());
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/healthCheck")
|
||||||
|
@ResponseBody
|
||||||
|
public String healthCheck() {
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* 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 test.apache.skywalking.apm.testcase.hystrix.controller;
|
||||||
|
|
||||||
|
import com.netflix.hystrix.HystrixCommand;
|
||||||
|
import com.netflix.hystrix.HystrixCommandGroupKey;
|
||||||
|
import com.netflix.hystrix.HystrixCommandProperties;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class TestACommand extends HystrixCommand<String> {
|
||||||
|
private Logger logger = LogManager.getLogger(TestACommand.class);
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
protected TestACommand(String name) {
|
||||||
|
super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("TestACommand"))
|
||||||
|
.andCommandPropertiesDefaults(
|
||||||
|
HystrixCommandProperties.Setter()
|
||||||
|
.withExecutionTimeoutInMilliseconds(1000)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String run() throws Exception {
|
||||||
|
Thread.sleep(2001);
|
||||||
|
try {
|
||||||
|
logger.info("start run: " + +Thread.currentThread().getId());
|
||||||
|
return "Hello " + name + "!";
|
||||||
|
} finally {
|
||||||
|
logger.info("start end");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFallback() {
|
||||||
|
try {
|
||||||
|
logger.info("getFallback run: " + Thread.currentThread().getId());
|
||||||
|
return "failed";
|
||||||
|
} finally {
|
||||||
|
logger.info("getFallback end");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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 test.apache.skywalking.apm.testcase.hystrix.controller;
|
||||||
|
|
||||||
|
import com.netflix.hystrix.HystrixCommand;
|
||||||
|
import com.netflix.hystrix.HystrixCommandGroupKey;
|
||||||
|
import com.netflix.hystrix.HystrixCommandProperties;
|
||||||
|
import com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStrategy;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class TestBCommand extends HystrixCommand<String> {
|
||||||
|
private Logger logger = LogManager.getLogger(TestACommand.class);
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
protected TestBCommand(String name) {
|
||||||
|
super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("TestBCommand"))
|
||||||
|
.andCommandPropertiesDefaults(
|
||||||
|
HystrixCommandProperties.Setter()
|
||||||
|
.withExecutionTimeoutInMilliseconds(1000)
|
||||||
|
).andCommandPropertiesDefaults(
|
||||||
|
HystrixCommandProperties.Setter()
|
||||||
|
.withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String run() throws Exception {
|
||||||
|
try {
|
||||||
|
logger.info("start run: " + Thread.currentThread().getId());
|
||||||
|
return "Hello " + name + "!";
|
||||||
|
} finally {
|
||||||
|
logger.info("start end");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFallback() {
|
||||||
|
try {
|
||||||
|
logger.info("getFallback run: " + Thread.currentThread().getId());
|
||||||
|
return "failed";
|
||||||
|
} finally {
|
||||||
|
logger.info("getFallback end");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
server:
|
||||||
|
port: 8080
|
||||||
|
servlet:
|
||||||
|
context-path: /hystrix-scenario
|
||||||
|
logging:
|
||||||
|
config: classpath:log4j2.xml
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
~
|
||||||
|
-->
|
||||||
|
<Configuration status="WARN">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="Console" target="SYSTEM_ERR">
|
||||||
|
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
|
||||||
|
</Console>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="WARN">
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
# 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
|
||||||
|
# "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.
|
||||||
|
|
||||||
|
1.4.20
|
||||||
|
1.4.21
|
||||||
|
1.4.22
|
||||||
|
1.4.23
|
||||||
|
1.4.24
|
||||||
|
1.4.25
|
||||||
|
1.4.26
|
||||||
|
1.5.0
|
||||||
|
1.5.1
|
||||||
|
1.5.2
|
||||||
|
1.5.3
|
||||||
|
1.5.4
|
||||||
|
1.5.5
|
||||||
|
1.5.6
|
||||||
|
1.5.7
|
||||||
|
1.5.8
|
||||||
|
1.5.9
|
||||||
|
1.5.10
|
||||||
|
1.5.11
|
||||||
|
1.5.12
|
||||||
Loading…
Reference in New Issue