提交 e39ff8e4 编写于 作者: Z zhangwei 提交者: wu-sheng

customize-scenario (#3773)

上级 0c99f1b5
......@@ -66,7 +66,7 @@ pipeline {
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl2_${BUILD_ID} docker:build'
}
}
stage('Test Cases Report (174)') {
stage('Test Cases Report (175)') {
steps {
echo "reserve."
}
......@@ -142,6 +142,12 @@ pipeline {
sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} undertow-scenario'
}
}
stage('customize-scenario (1)') {
steps {
sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} customize-scenario'
}
}
}
}
}
......
#!/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} \
-Dskywalking.plugin.customize.enhance_file=${home}/../config/customize_enhance.xml \
${home}/../libs/customize-scenario.jar &
\ No newline at end of file
<?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.
~
-->
<enhanced>
<class class_name="test.org.apache.skywalking.apm.testcase.customize.service.TestService1">
<method method="staticMethod()" operation_name="/is_static_method" static="true"></method>
<method method="staticMethod(java.lang.String,int.class,java.util.Map,java.util.List,[Ljava.lang.Object;)" operation_name="/is_static_method_args" static="true">
<operation_name_suffix>arg[0]</operation_name_suffix>
<operation_name_suffix>arg[1]</operation_name_suffix>
<operation_name_suffix>arg[3].[0]</operation_name_suffix>
<tag key="tag_1">arg[2].['k1']</tag>
<tag key="tag_2">arg[4].[1]</tag>
<log key="log_1">arg[4].[2]</log>
</method>
<method method="method()" static="false"></method>
<method method="method(java.lang.String,int.class)" operation_name="/method_2" static="false">
<operation_name_suffix>arg[0]</operation_name_suffix>
<tag key="tag_1">arg[0]</tag>
<log key="log_1">arg[1]</log>
</method>
<method method="method(test.org.apache.skywalking.apm.testcase.customize.model.Model0,java.lang.String,int.class)" operation_name="/method_3" static="false">
<operation_name_suffix>arg[0].id</operation_name_suffix>
<operation_name_suffix>arg[0].model1.name</operation_name_suffix>
<operation_name_suffix>arg[0].model1.getId()</operation_name_suffix>
<tag key="tag_os">arg[0].os.[1]</tag>
<log key="log_map">arg[0].getM().['k1']</log>
</method>
</class>
<class class_name="test.org.apache.skywalking.apm.testcase.customize.service.TestService2">
<method method="staticMethod(java.lang.String,int.class)" operation_name="/is_2_static_method" static="true">
<tag key="tag_2_1">arg[0]</tag>
<log key="log_1_1">arg[1]</log>
</method>
<method method="method([Ljava.lang.Object;)" operation_name="/method_4" static="false">
<tag key="tag_4_1">arg[0].[0]</tag>CustomizeController
</method>
<method method="method(java.util.List,int.class)" operation_name="/method_5" static="false">
<tag key="tag_5_1">arg[0].[0]</tag>
<log key="log_5_1">arg[1]</log>
</method>
</class>
</enhanced>
\ No newline at end of file
# 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:
- {customize-scenario: nq 0}
instances:
- {customize-scenario: 1}
operationNames:
- customize-scenario: [/case/customize]
segmentItems:
- applicationCode: customize-scenario
segmentSize: gt 1
segments:
- segmentId: not null
spans:
- operationName: /is_static_method
operationId: 0
parentSpanId: 0
spanId: 1
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
- operationName: /is_static_method_args/id/123/a
operationId: 0
parentSpanId: 0
spanId: 2
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
tags:
- {key: tag_1, value: v1}
- {key: tag_2, value: '2'}
logs:
- logEvent:
- {key: log_1, value: '3'}
- operationName: test.org.apache.skywalking.apm.testcase.customize.service.TestService1.method()
operationId: 0
parentSpanId: 0
spanId: 3
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
- operationName: /method_2/str0
operationId: 0
parentSpanId: 0
spanId: 4
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
tags:
- {key: tag_1, value: str0}
logs:
- logEvent:
- {key: log_1, value: '123'}
- operationName: /method_3/id/name/100
operationId: 0
parentSpanId: 0
spanId: 5
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
tags:
- {key: tag_os, value: '2'}
logs:
- logEvent:
- {key: log_map, value: v1}
- operationName: /is_2_static_method
operationId: 0
parentSpanId: 0
spanId: 6
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
tags:
- {key: tag_2_1, value: s}
logs:
- logEvent:
- {key: log_1_1, value: '123'}
- operationName: /method_4
operationId: 0
parentSpanId: 0
spanId: 7
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
tags:
- {key: tag_4_1, value: '1'}
- operationName: /method_5
operationId: 0
parentSpanId: 0
spanId: 8
startTime: nq 0
endTime: nq 0
componentName: ''
isError: false
peerId: 0
spanType: Local
tags:
- {key: tag_5_1, value: a2}
logs:
- logEvent:
- {key: log_5_1, value: '123'}
- operationName: /case/customize
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: 'not null'
endTime: 'not null'
componentId: 14
componentName: ''
isError: false
spanType: Entry
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/customize-scenario/case/customize'}
- {key: http.method, value: GET}
\ No newline at end of file
# 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/customize-scenario/case/customize
healthCheck: http://localhost:8080/customize-scenario/case/healthCheck
startScript: ./bin/startup.sh
framework: customize-scenario
runningMode: with_optional
withPlugins: apm-customize-enhance-plugin-*.jar
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking</groupId>
<artifactId>customize-scenario</artifactId>
<version>5.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
<test.framework>customize-scenario</test.framework>
<test.framework.version>1.0.0</test.framework.version>
</properties>
<name>skywalking-customize-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>
</dependency>
</dependencies>
<build>
<finalName>customize-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>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
\ No newline at end of file
<?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>./target/customize-scenario.jar</source>
<outputDirectory>./libs</outputDirectory>
<fileMode>0775</fileMode>
</file>
<file>
<source>./config/customize_enhance.xml</source>
<outputDirectory>./config</outputDirectory>
<fileMode>0555</fileMode>
</file>
</files>
</assembly>
\ No newline at end of file
/*
* 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.org.apache.skywalking.apm.testcase.customize;
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
}
}
}
/*
* 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.org.apache.skywalking.apm.testcase.customize.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import test.org.apache.skywalking.apm.testcase.customize.model.Model0;
import test.org.apache.skywalking.apm.testcase.customize.model.Model1;
import test.org.apache.skywalking.apm.testcase.customize.service.TestService1;
import test.org.apache.skywalking.apm.testcase.customize.service.TestService2;
import java.util.ArrayList;
import java.util.HashMap;
@RestController
@RequestMapping("/case")
public class CustomizeController {
private Logger logger = LoggerFactory.getLogger(CustomizeController.class);
private static final String SUCCESS = "Success";
private TestService1 testService1 = new TestService1();
private TestService2 testService2 = new TestService2();
@RequestMapping("/customize")
@ResponseBody
public String customizeCase() {
Model0 m0 = new Model0("id", 123, new Model1(100, "name"), new HashMap() {{
put("k1", "v1");
}}, new ArrayList() {{
add("a");
}}, new Object[] {'1', 2, "3"});
TestService1.staticMethod();
TestService1.staticMethod("id", 123, new HashMap() {{
put("k1", "v1");
}}, new ArrayList() {{
add("a");
}}, new Object[] {'1', 2, "3"});
testService1.method();
testService1.method("str0", 123);
testService1.method(m0, "def_str_0", 123);
TestService2.staticMethod("s", 123);
testService2.method(new Object[] {'1', 2, "3"});
testService2.method(new ArrayList() {{
add("a2");
}}, 123);
logger.info(SUCCESS);
return SUCCESS;
}
@RequestMapping("/healthCheck")
@ResponseBody
public String healthCheck() {
return SUCCESS;
}
}
/*
* 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.org.apache.skywalking.apm.testcase.customize.model;
import java.util.List;
import java.util.Map;
/**
* @author zhaoyuguang
*/
public class Model0 {
public Model0(String id, int num, Model1 model1, Map m, List l, Object[] os) {
this.id = id;
this.num = num;
this.model1 = model1;
this.m = m;
this.l = l;
this.os = os;
}
private String id;
private int num;
private Model1 model1;
private Map m;
private List l;
private Object[] os;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public Model1 getModel1() {
return model1;
}
public void setModel1(Model1 model1) {
this.model1 = model1;
}
public Map getM() {
return m;
}
public void setM(Map m) {
this.m = m;
}
public List getL() {
return l;
}
public void setL(List l) {
this.l = l;
}
public Object[] getOs() {
return os;
}
public void setOs(Object[] os) {
this.os = os;
}
}
/*
* 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.org.apache.skywalking.apm.testcase.customize.model;
/**
* @author zhaoyuguang
*/
public class Model1 {
public Model1(int id, String name) {
this.id = id;
this.name = name;
}
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
/*
* 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.org.apache.skywalking.apm.testcase.customize.service;
import test.org.apache.skywalking.apm.testcase.customize.model.Model0;
import java.util.List;
import java.util.Map;
/**
* @author zhaoyuguang
*/
public class TestService1 {
public static void staticMethod() {
}
public static void staticMethod(String str0, int count, Map m, List l, Object[] os) {
}
public void method() {
}
public void method(String str0, int count) {
}
public void method(Model0 m0, String str0, int count) {
}
}
/*
* 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.org.apache.skywalking.apm.testcase.customize.service;
import java.util.List;
/**
* @author zhaoyuguang
*/
public class TestService2 {
public static void staticMethod(String str0, int count) {
}
public void method(Object[] objects) {
}
public void method(List str0, int count) {
}
}
#
# 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: /customize-scenario
\ No newline at end of file
# 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.
1.0.0
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册