diff --git a/Jenkinsfile-Agent-Test-3 b/Jenkinsfile-Agent-Test-3
index d8e5798b0..e085418ba 100755
--- a/Jenkinsfile-Agent-Test-3
+++ b/Jenkinsfile-Agent-Test-3
@@ -57,7 +57,7 @@ pipeline {
}
}
- stage('Test Cases Report (129)') {
+ stage('Test Cases Report (132)') {
steps {
echo "reserve."
}
@@ -81,6 +81,11 @@ pipeline {
sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} sofarpc-scenario'
}
}
+ stage('elasticsearch 5.x (3)') {
+ steps {
+ sh 'bash test/plugin/run.sh --build_id=wl3_${BUILD_ID} elasticsearch-5.x-scenario'
+ }
+ }
}
}
stage('Group2') {
@@ -107,4 +112,4 @@ pipeline {
deleteDir()
}
}
-}
\ No newline at end of file
+}
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/bin/startup.sh b/test/plugin/scenarios/elasticsearch-5.x-scenario/bin/startup.sh
new file mode 100644
index 000000000..82539985c
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/bin/startup.sh
@@ -0,0 +1,20 @@
+#!/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/elasticsearch-5.x-scenario.jar &
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..118fcfb0d
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml
@@ -0,0 +1,177 @@
+# 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:
+ - {elasticsearch-5.x-scenario: nq 0}
+ instances:
+ - {elasticsearch-5.x-scenario: 1}
+ operationNames:
+ - elasticsearch-5.x-scenario: [Elasticsearch/IndexRequest, Elasticsearch/GetRequest,
+ Elasticsearch/SearchRequest, Elasticsearch/UpdateRequest,
+ Elasticsearch/DeleteRequest, Elasticsearch/DeleteIndexRequest,
+ /case/elasticsearch]
+ heartbeat: []
+segmentItems:
+- applicationCode: elasticsearch-5.x-scenario
+ segmentSize: ge 1
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: Elasticsearch/IndexRequest
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Database
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: not null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - {key: db.instance, value: not null}
+ - {key: node.address, value: not null}
+ - {key: es.indices, value: not null}
+ - {key: es.types, value: not null}
+ - operationName: Elasticsearch/actionGet
+ operationId: 0
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: null
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Local
+ peer: null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - operationName: Elasticsearch/GetRequest
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Database
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: not null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - {key: db.instance, value: not null}
+ - {key: node.address, value: not null}
+ - {key: es.indices, value: not null}
+ - {key: es.types, value: not null}
+ - operationName: Elasticsearch/SearchRequest
+ operationId: 0
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Database
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: not null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - {key: db.instance, value: not null}
+ - {key: node.address, value: not null}
+ - {key: es.indices, value: not null}
+ - {key: es.types, value: not null}
+ - operationName: Elasticsearch/UpdateRequest
+ operationId: 0
+ parentSpanId: 0
+ spanId: 5
+ spanLayer: Database
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: not null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - {key: db.instance, value: not null}
+ - {key: node.address, value: not null}
+ - {key: es.indices, value: not null}
+ - {key: es.types, value: not null}
+ - operationName: Elasticsearch/DeleteRequest
+ operationId: 0
+ parentSpanId: 0
+ spanId: 6
+ spanLayer: Database
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: not null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - {key: db.instance, value: not null}
+ - {key: node.address, value: not null}
+ - {key: es.indices, value: not null}
+ - {key: es.types, value: not null}
+ - operationName: Elasticsearch/DeleteIndexRequest
+ operationId: 0
+ parentSpanId: 0
+ spanId: 7
+ spanLayer: Database
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 48
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: not null
+ peerId: 0
+ tags:
+ - {key: db.type, value: Elasticsearch}
+ - {key: db.instance, value: not null}
+ - {key: node.address, value: not null}
+ - {key: es.indices, value: ''}
+ - {key: es.types, value: ''}
+ - operationName: /case/elasticsearch
+ 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/elasticsearch-case/case/elasticsearch'}
+ - {key: http.method, value: GET}
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/configuration.yml b/test/plugin/scenarios/elasticsearch-5.x-scenario/configuration.yml
new file mode 100644
index 000000000..ce958778f
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/configuration.yml
@@ -0,0 +1,34 @@
+# 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/elasticsearch-case/case/elasticsearch
+healthCheck: http://localhost:8080/elasticsearch-case/case/healthcheck
+startScript: ./bin/startup.sh
+framework: elasticsearch
+environment:
+ - elasticsearch.server=elasticsearch-server
+dependencies:
+ elasticsearch-server:
+ image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
+ hostname: elasticsearch-server
+ expose:
+ - 9300
+ - 9200
+ environment:
+ - cluster.name=docker-node
+ - xpack.security.enabled=false
+ - bootstrap.memory_lock=true
+ - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
+ - discovery.type=single-node
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/pom.xml b/test/plugin/scenarios/elasticsearch-5.x-scenario/pom.xml
new file mode 100644
index 000000000..aadd20e91
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/pom.xml
@@ -0,0 +1,128 @@
+
+
+
+ 4.0.0
+
+ org.apache.skywalking
+ elasticsearch-5.x-scenario
+ 5.0.0
+
+ skywalking-elasticsearch-5.x-scenario
+
+
+ UTF-8
+ 1.8
+
+ 5.4.0
+ ${test.framework.version}
+
+ 2.1.4.RELEASE
+ 1.16.20
+ 2.8.1
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${spring-boot.version}
+
+
+ spring-boot-starter-logging
+ org.springframework.boot
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${spring-boot.version}
+
+
+
+ org.elasticsearch.client
+ transport
+ ${test.framework.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+ org.apache.logging.log4j
+ log4j-api
+ ${log4j.version}
+
+
+ org.apache.logging.log4j
+ log4j-core
+ ${log4j.version}
+
+
+
+
+ elasticsearch-5.x-scenario
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.0
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 1.5.9.RELEASE
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+
+
+
+
+
+
+
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..b51412769
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/elasticsearch-5.x-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/elasticsearch/Application.java b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/elasticsearch/Application.java
new file mode 100644
index 000000000..e177596ac
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/elasticsearch/Application.java
@@ -0,0 +1,34 @@
+/*
+ * 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.elasticsearch;
+
+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
+ }
+ }
+}
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java
new file mode 100644
index 000000000..ae40a01ce
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java
@@ -0,0 +1,143 @@
+/*
+ * 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.elasticsearch.controller;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.UUID;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
+import org.elasticsearch.client.Client;
+import org.elasticsearch.client.transport.TransportClient;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.transport.InetSocketTransportAddress;
+import org.elasticsearch.common.xcontent.XContentFactory;
+import org.elasticsearch.transport.client.PreBuiltTransportClient;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+ private static Logger logger = LogManager.getLogger(CaseController.class);
+
+ @Value("${elasticsearch.server}")
+ private String host;
+
+ @GetMapping("/healthcheck")
+ public String healthcheck() throws Exception {
+ Client client = initTransportClient();
+ ClusterHealthResponse response = client.admin().cluster().prepareHealth()
+ .setWaitForYellowStatus()
+ .get();
+ if (response.isTimedOut()) {
+ String message = "elastic search node start fail!";
+ logger.error(message);
+ throw new RuntimeException(message);
+ }
+ client.close();
+ return "Success";
+ }
+
+ @GetMapping("/elasticsearch")
+ public String elasticsearch() throws Exception {
+ Client client = initTransportClient();
+ String indexName = UUID.randomUUID().toString();
+ try {
+ // create
+ index(client, indexName);
+ // get
+ get(client, indexName);
+ // search
+ search(client, indexName);
+ // update
+ update(client, indexName);
+ // delete
+ delete(client, indexName);
+ // remove index
+ client.admin().indices().prepareDelete(indexName).execute();
+ } finally {
+ if (null != client) {
+ client.close();
+ }
+ }
+ return "Success";
+ }
+
+ private void index(Client client, String indexName) throws IOException {
+ try {
+ client.prepareIndex(indexName, "test", "1")
+ .setSource(XContentFactory.jsonBuilder()
+ .startObject()
+ .field("name", "mysql innodb")
+ .field("price", "0")
+ .field("language", "chinese")
+ .endObject())
+ .get();
+ } catch (IOException e) {
+ logger.error("index document error.", e);
+ throw e;
+ }
+ }
+
+ private void get(Client client, String indexName) {
+ client.prepareGet().setIndex(indexName).setId("1").execute();
+ }
+
+ private void update(Client client, String indexName) throws IOException {
+ try {
+ client.prepareUpdate(indexName, "test", "1")
+ .setDoc(XContentFactory.jsonBuilder().startObject().field("price", "9.9").endObject())
+ .execute();
+ } catch (IOException e) {
+ logger.error("update document error.", e);
+ throw e;
+ }
+ }
+
+ private void delete(Client client, String indexName) {
+ client.prepareDelete(indexName, "test", "1").execute();
+ }
+
+ private void search(Client client, String indexName) {
+ client.prepareSearch(indexName).setTypes("test").setSize(10).execute();
+ }
+
+ private Client initTransportClient() throws UnknownHostException {
+ TransportClient client = null;
+ try {
+ Settings settings = Settings.builder()
+ .put("cluster.name", "docker-node")
+ .put("client.transport.sniff", false)
+ .build();
+
+ client = new PreBuiltTransportClient(settings)
+ .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), 9300));
+ } catch (UnknownHostException e) {
+ logger.error("create client error", e);
+ throw e;
+ }
+ return client;
+ }
+}
+
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/resources/application.yml b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/resources/application.yml
new file mode 100644
index 000000000..de5bb9b59
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/resources/application.yml
@@ -0,0 +1,19 @@
+# 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: /elasticsearch-case
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..985bd03bf
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/support-version.list b/test/plugin/scenarios/elasticsearch-5.x-scenario/support-version.list
new file mode 100644
index 000000000..cd7e890d4
--- /dev/null
+++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/support-version.list
@@ -0,0 +1,18 @@
+# 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.
+5.4.0
+5.4.1
+5.4.2