From 438d2954232ee7b996ca0a7d961eddcd2da0c5e6 Mon Sep 17 00:00:00 2001 From: xzyJavaX <49760141+xzyJavaX@users.noreply.github.com> Date: Fri, 24 Jun 2022 09:17:37 +0800 Subject: [PATCH] update witness class in elasticsearch-6.x-plugin (#228) * update witness class in elasticsearch-6.x-plugin * update test cases in elasticsearch-6.x-plugin * update the supported list Co-authored-by: xzy --- .github/workflows/plugins-test.0.yaml | 3 +- CHANGES.md | 3 +- .../RestHighLevelClientInstrumentation.java | 2 +- .../v6/interceptor/Constants.java | 1 + .../java-agent/Supported-list.md | 2 +- .../bin/startup.sh | 20 +++ .../config/expectedData.yaml | 120 +------------- .../configuration.yml | 0 .../pom.xml | 12 +- .../src/main/assembly/assembly.xml | 41 +++++ .../testcase/elasticsearch/Application.java | 0 .../RestHighLevelClientCase.java | 0 .../config/ElasticsearchConfig.java | 0 .../controller/CaseController.java | 6 - .../src/main/resource/application.yml | 0 .../src/main/resource/log4j2.xml | 0 .../support-version.list | 0 .../bin/startup.sh | 2 +- .../config/expectedData.yaml | 153 ++++++++++++++++++ .../configuration.yml | 33 ++++ .../pom.xml | 127 +++++++++++++++ .../src/main/assembly/assembly.xml | 2 +- .../testcase/elasticsearch/Application.java | 34 ++++ .../elasticsearch/TransportClientCase.java | 0 .../config/TransportClientConfig.java | 0 .../controller/CaseController.java | 50 ++++++ .../src/main/resource/application.yml | 17 ++ .../src/main/resource/log4j2.xml | 31 ++++ .../support-version.list | 23 +++ 29 files changed, 542 insertions(+), 140 deletions(-) create mode 100644 test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/bin/startup.sh rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/config/expectedData.yaml (72%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/configuration.yml (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/pom.xml (92%) create mode 100644 test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/assembly/assembly.xml rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/RestHighLevelClientCase.java (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/ElasticsearchConfig.java (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java (90%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/src/main/resource/application.yml (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/src/main/resource/log4j2.xml (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-rest-high-level-6.x-scenario}/support-version.list (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-transport-6.x-scenario}/bin/startup.sh (92%) create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/pom.xml rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-transport-6.x-scenario}/src/main/assembly/assembly.xml (94%) create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-transport-6.x-scenario}/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/TransportClientCase.java (100%) rename test/plugin/scenarios/{elasticsearch-6.x-scenario => elasticsearch-transport-6.x-scenario}/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/TransportClientConfig.java (100%) create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/application.yml create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/log4j2.xml create mode 100644 test/plugin/scenarios/elasticsearch-transport-6.x-scenario/support-version.list diff --git a/.github/workflows/plugins-test.0.yaml b/.github/workflows/plugins-test.0.yaml index 7a083fffb..ab768b74a 100644 --- a/.github/workflows/plugins-test.0.yaml +++ b/.github/workflows/plugins-test.0.yaml @@ -70,7 +70,8 @@ jobs: - dubbo-3.x-scenario - ehcache-2.x-scenario - elasticsearch-5.x-scenario - - elasticsearch-6.x-scenario + - elasticsearch-rest-high-level-6.x-scenario + - elasticsearch-transport-6.x-scenario - elasticsearch-7.x-scenario - exception-checker-spring-scenario - exception-checker-tomcat-scenario diff --git a/CHANGES.md b/CHANGES.md index 319019009..12e4f349b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,8 @@ Release Notes. 8.12.0 ------------------ * Fix `Shenyu plugin`'s NPE in reading read trace ID when IgnoredTracerContext is used in the context. -* Fix `onHalfClose` using span operation name `/Request/onComplete` but not `/Request/onHalfClose` +* Update witness class in elasticsearch-6.x-plugin, avoid throw NPE. +* Fix `onHalfClose` using span operation name `/Request/onComplete` instead of the worng name `/Request/onHalfClose`. #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/define/RestHighLevelClientInstrumentation.java b/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/define/RestHighLevelClientInstrumentation.java index 6adb02e39..772844903 100644 --- a/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/define/RestHighLevelClientInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/define/RestHighLevelClientInstrumentation.java @@ -260,6 +260,6 @@ public class RestHighLevelClientInstrumentation extends ClassEnhancePluginDefine @Override protected String[] witnessClasses() { - return new String[] {Constants.TASK_TRANSPORT_CHANNEL_WITNESS_CLASSES}; + return new String[] {Constants.CREATE_INDEX_RESPONSE_WITNESS_CLASSES}; } } diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/interceptor/Constants.java b/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/interceptor/Constants.java index 638b98bbb..0819a5326 100644 --- a/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/interceptor/Constants.java +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/interceptor/Constants.java @@ -44,6 +44,7 @@ public class Constants { //witnessClasses public static final String TASK_TRANSPORT_CHANNEL_WITNESS_CLASSES = "org.elasticsearch.transport.TaskTransportChannel"; public static final String SEARCH_HITS_WITNESS_CLASSES = "org.elasticsearch.search.SearchHits"; + public static final String CREATE_INDEX_RESPONSE_WITNESS_CLASSES = "org.elasticsearch.client.indices.CreateIndexResponse"; //es operator name public static final String CREATE_OPERATOR_NAME = "Elasticsearch/CreateRequest"; diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md index 8179e3e63..66d8d77f6 100644 --- a/docs/en/setup/service-agent/java-agent/Supported-list.md +++ b/docs/en/setup/service-agent/java-agent/Supported-list.md @@ -78,7 +78,7 @@ metrics based on the tracing data. * [Xmemcached](https://github.com/killme2008/xmemcached) 2.x * [Elasticsearch](https://github.com/elastic/elasticsearch) * [transport-client](https://github.com/elastic/elasticsearch/tree/v5.2.0/client/transport) 5.2.x-5.6.x - * [transport-client](https://github.com/elastic/elasticsearch/tree/v6.7.1/client/transport) 6.7.1-6.8.4 + * [transport-client](https://github.com/elastic/elasticsearch/tree/v6.2.3/client/transport) 6.2.3-6.8.4 * [transport-client](https://github.com/elastic/elasticsearch/tree/7.0/client/transport) 7.0.0-7.5.2 * [rest-high-level-client](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.7/index.html) 6.7.1-6.8.4 * [rest-high-level-client](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.0/java-rest-high.html) 7.0.0-7.5.2 diff --git a/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/bin/startup.sh b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/bin/startup.sh new file mode 100644 index 000000000..56ede50e2 --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-rest-high-level-6.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} -Dskywalking.plugin.elasticsearch.trace_dsl=true ${home}/../libs/elasticsearch-rest-high-level-6.x-scenario.jar & diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/config/expectedData.yaml similarity index 72% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/config/expectedData.yaml index cb9def25b..fc04efc54 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/config/expectedData.yaml @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. segmentItems: -- serviceName: elasticsearch-6.x-scenario +- serviceName: elasticsearch-rest-high-level-6.x-scenario segmentSize: ge 1 segments: - segmentId: not null @@ -307,124 +307,6 @@ segmentItems: - {key: db.type, value: Elasticsearch} - {key: db.instance, value: not null} skipAnalysis: 'false' - - operationName: Elasticsearch/IndexRequest - parentSpanId: 0 - spanId: 21 - spanLayer: Database - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Exit - peer: not null - 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} - - {key: db.statement, value: not null} - skipAnalysis: 'false' - - operationName: Elasticsearch/actionGet - parentSpanId: 0 - spanId: 22 - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Local - tags: - - {key: db.type, value: Elasticsearch} - - {key: db.statement, value: not null} - skipAnalysis: 'false' - - operationName: Elasticsearch/GetRequest - parentSpanId: 0 - spanId: 23 - spanLayer: Database - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Exit - peer: not null - 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} - - {key: db.statement, value: not null} - skipAnalysis: 'false' - - operationName: Elasticsearch/SearchRequest - parentSpanId: 0 - spanId: 24 - spanLayer: Database - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Exit - peer: not null - 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} - - {key: db.statement, value: not null} - skipAnalysis: 'false' - - operationName: Elasticsearch/UpdateRequest - parentSpanId: 0 - spanId: 25 - spanLayer: Database - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Exit - peer: not null - 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} - - {key: db.statement, value: not null} - skipAnalysis: 'false' - - operationName: Elasticsearch/DeleteRequest - parentSpanId: 0 - spanId: 26 - spanLayer: Database - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Exit - peer: not null - 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} - - {key: db.statement, value: not null} - skipAnalysis: 'false' - - operationName: Elasticsearch/DeleteIndexRequest - parentSpanId: 0 - spanId: 27 - spanLayer: Database - startTime: nq 0 - endTime: nq 0 - componentId: 48 - isError: false - spanType: Exit - peer: not null - tags: - - {key: db.type, value: Elasticsearch} - - {key: db.instance, value: not null} - - {key: node.address, value: not null} - - {key: es.indices, value: not null} - skipAnalysis: 'false' - operationName: GET:/elasticsearch-case/case/elasticsearch parentSpanId: -1 spanId: 0 diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/configuration.yml b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/configuration.yml similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/configuration.yml rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/configuration.yml diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/pom.xml b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/pom.xml similarity index 92% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/pom.xml rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/pom.xml index eb08d29f4..c8b8a37d2 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/pom.xml +++ b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/pom.xml @@ -22,10 +22,10 @@ 4.0.0 org.apache.skywalking - elasticsearch-6.x-scenario + elasticsearch-rest-high-level-6.x-scenario 5.0.0 - skywalking-elasticsearch-6.x-scenario + skywalking-elasticsearch-rest-high-level-6.x-scenario UTF-8 @@ -56,12 +56,6 @@ spring-boot-starter-web ${spring-boot.version} - - - org.elasticsearch.client - transport - ${test.framework.version} - org.elasticsearch.client @@ -86,7 +80,7 @@ - elasticsearch-6.x-scenario + elasticsearch-rest-high-level-6.x-scenario org.apache.maven.plugins diff --git a/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..c90c74dcd --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/elasticsearch-rest-high-level-6.x-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/RestHighLevelClientCase.java b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/RestHighLevelClientCase.java similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/RestHighLevelClientCase.java rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/RestHighLevelClientCase.java diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/ElasticsearchConfig.java b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/ElasticsearchConfig.java similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/ElasticsearchConfig.java rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/ElasticsearchConfig.java diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java similarity index 90% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java index a93623b7a..659743cf9 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java +++ b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java @@ -21,7 +21,6 @@ package org.apache.skywalking.apm.testcase.elasticsearch.controller; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.skywalking.apm.testcase.elasticsearch.RestHighLevelClientCase; -import org.apache.skywalking.apm.testcase.elasticsearch.TransportClientCase; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -36,9 +35,6 @@ public class CaseController { @Autowired private RestHighLevelClientCase restHighLevelClientCase; - @Autowired - private TransportClientCase transportClientCase; - @GetMapping("/healthcheck") public String healthcheck() throws Exception { restHighLevelClientCase.healthcheck(); @@ -48,8 +44,6 @@ public class CaseController { @GetMapping("/elasticsearch") public String elasticsearch() throws Exception { restHighLevelClientCase.elasticsearch(); - transportClientCase.elasticsearch(); - return "Success"; } diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/resource/application.yml b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/resource/application.yml similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/resource/application.yml rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/resource/application.yml diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/resource/log4j2.xml b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/resource/log4j2.xml similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/resource/log4j2.xml rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/src/main/resource/log4j2.xml diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/support-version.list b/test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/support-version.list similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/support-version.list rename to test/plugin/scenarios/elasticsearch-rest-high-level-6.x-scenario/support-version.list diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/bin/startup.sh b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/bin/startup.sh similarity index 92% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/bin/startup.sh rename to test/plugin/scenarios/elasticsearch-transport-6.x-scenario/bin/startup.sh index 8cc08f548..f99ca21fb 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/bin/startup.sh +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/bin/startup.sh @@ -17,4 +17,4 @@ home="$(cd "$(dirname $0)"; pwd)" -java -jar ${agent_opts} -Dskywalking.plugin.elasticsearch.trace_dsl=true ${home}/../libs/elasticsearch-6.x-scenario.jar & +java -jar ${agent_opts} -Dskywalking.plugin.elasticsearch.trace_dsl=true ${home}/../libs/elasticsearch-transport-6.x-scenario.jar & diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000..65355eff4 --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/config/expectedData.yaml @@ -0,0 +1,153 @@ +# 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. +segmentItems: +- serviceName: elasticsearch-transport-6.x-scenario + segmentSize: ge 1 + segments: + - segmentId: not null + spans: + - operationName: Elasticsearch/IndexRequest + parentSpanId: 0 + spanId: 1 + spanLayer: Database + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Exit + peer: not null + 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} + - {key: db.statement, value: not null} + skipAnalysis: 'false' + - operationName: Elasticsearch/actionGet + parentSpanId: 0 + spanId: 2 + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Local + tags: + - {key: db.type, value: Elasticsearch} + - {key: db.statement, value: not null} + skipAnalysis: 'false' + - operationName: Elasticsearch/GetRequest + parentSpanId: 0 + spanId: 3 + spanLayer: Database + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Exit + peer: not null + 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} + - {key: db.statement, value: not null} + skipAnalysis: 'false' + - operationName: Elasticsearch/SearchRequest + parentSpanId: 0 + spanId: 4 + spanLayer: Database + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Exit + peer: not null + 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} + - {key: db.statement, value: not null} + skipAnalysis: 'false' + - operationName: Elasticsearch/UpdateRequest + parentSpanId: 0 + spanId: 5 + spanLayer: Database + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Exit + peer: not null + 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} + - {key: db.statement, value: not null} + skipAnalysis: 'false' + - operationName: Elasticsearch/DeleteRequest + parentSpanId: 0 + spanId: 6 + spanLayer: Database + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Exit + peer: not null + 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} + - {key: db.statement, value: not null} + skipAnalysis: 'false' + - operationName: Elasticsearch/DeleteIndexRequest + parentSpanId: 0 + spanId: 7 + spanLayer: Database + startTime: nq 0 + endTime: nq 0 + componentId: 48 + isError: false + spanType: Exit + peer: not null + tags: + - {key: db.type, value: Elasticsearch} + - {key: db.instance, value: not null} + - {key: node.address, value: not null} + - {key: es.indices, value: not null} + skipAnalysis: 'false' + - operationName: GET:/elasticsearch-case/case/elasticsearch + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + isError: false + spanType: Entry + peer: '' + tags: + - {key: url, value: 'http://localhost:8080/elasticsearch-case/case/elasticsearch'} + - {key: http.method, value: GET} + skipAnalysis: 'false' diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml new file mode 100644 index 000000000..cafc4a057 --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/configuration.yml @@ -0,0 +1,33 @@ +# 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 +environment: + - elasticsearch.server=elasticsearch-server-6.x:9200 +dependencies: + elasticsearch-server-6.x: + image: bitnami/elasticsearch:${CASE_SERVER_IMAGE_VERSION} + hostname: elasticsearch-server-6.x + removeOnExit: true + expose: + - 9200 + environment: + - ELASTICSEARCH_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-transport-6.x-scenario/pom.xml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/pom.xml new file mode 100644 index 000000000..f74c5d25b --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/pom.xml @@ -0,0 +1,127 @@ + + + + 4.0.0 + + org.apache.skywalking + elasticsearch-transport-6.x-scenario + 5.0.0 + + skywalking-elasticsearch-transport-6.x-scenario + + + UTF-8 + 1.8 + + 6.8.6 + ${test.framework.version} + + 2.1.4.RELEASE + 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.elasticsearch + elasticsearch + ${test.framework.version} + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + + + elasticsearch-transport-6.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-6.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/assembly/assembly.xml similarity index 94% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/assembly/assembly.xml rename to test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/assembly/assembly.xml index 14cfcb616..05166e5f8 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/assembly/assembly.xml +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/assembly/assembly.xml @@ -33,7 +33,7 @@ - ${project.build.directory}/elasticsearch-6.x-scenario.jar + ${project.build.directory}/elasticsearch-transport-6.x-scenario.jar ./libs 0775 diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/Application.java new file mode 100644 index 000000000..79eda0b8b --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/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 org.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-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/TransportClientCase.java b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/TransportClientCase.java similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/TransportClientCase.java rename to test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/TransportClientCase.java diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/TransportClientConfig.java b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/TransportClientConfig.java similarity index 100% rename from test/plugin/scenarios/elasticsearch-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/TransportClientConfig.java rename to test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/config/TransportClientConfig.java diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java new file mode 100644 index 000000000..eb7d61677 --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticsearch/controller/CaseController.java @@ -0,0 +1,50 @@ +/* + * 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 org.apache.skywalking.apm.testcase.elasticsearch.controller; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.skywalking.apm.testcase.elasticsearch.TransportClientCase; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/elasticsearch-case/case") +public class CaseController { + + private static final Logger LOGGER = LogManager.getLogger(CaseController.class); + + @Autowired + private TransportClientCase transportClientCase; + + @GetMapping("/healthcheck") + public String healthcheck() throws Exception { + return "Success"; + } + + @GetMapping("/elasticsearch") + public String elasticsearch() throws Exception { + transportClientCase.elasticsearch(); + return "Success"; + } + +} + diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/application.yml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/application.yml new file mode 100644 index 000000000..a2f8b0f19 --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/application.yml @@ -0,0 +1,17 @@ +# 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 diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/log4j2.xml b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/log4j2.xml new file mode 100644 index 000000000..985bd03bf --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/src/main/resource/log4j2.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/support-version.list b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/support-version.list new file mode 100644 index 000000000..8032084a7 --- /dev/null +++ b/test/plugin/scenarios/elasticsearch-transport-6.x-scenario/support-version.list @@ -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. + +6.2.3 +6.3.2 +6.4.1 +6.5.3 +6.6.2 +6.7.2 +6.8.4