This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-java.git
The following commit(s) were added to refs/heads/main by this push: new 969a25868 Remove inappropriate dependency from elasticsearch-7.x-plugin (#299) 969a25868 is described below commit 969a25868314ee8f6ed949bd3ec32531a4c5c708 Author: pg.yang <pg.y...@hotmail.com> AuthorDate: Wed Aug 31 17:20:32 2022 +0800 Remove inappropriate dependency from elasticsearch-7.x-plugin (#299) --- CHANGES.md | 1 + .../elasticsearch-7.x-plugin/pom.xml | 6 ---- .../apm/plugin/elasticsearch/v7/Constants.java | 37 ++++++++++++++++++++++ .../v7/ElasticsearchPluginConfig.java | 35 ++++++++++++++++++++ .../define/AdapterActionFutureInstrumentation.java | 7 ++-- ...terActionFutureActionGetMethodsInterceptor.java | 9 +++--- 6 files changed, 82 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 07b4b131d..bc9ab7871 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ Release Notes. * Plugin to support xxl-job 2.3.x. * Add plugin to support Micronaut(HTTP Client/Server) 3.2.x-3.6.x * Add plugin to support NATS Java client 2.14.x-2.15.x +* Remove inappropriate dependency from elasticsearch-7.x-plugin #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/pom.xml index c0d1d7275..e41b210a5 100644 --- a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/pom.xml @@ -42,11 +42,5 @@ <version>${elasticsearch.rest.high.level.client.version}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.apache.skywalking</groupId> - <artifactId>apm-elasticsearch-6.x-plugin</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> </dependencies> </project> diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/Constants.java b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/Constants.java new file mode 100644 index 000000000..2809f2a91 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/Constants.java @@ -0,0 +1,37 @@ +/* + * 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.plugin.elasticsearch.v7; + +import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag; +import org.apache.skywalking.apm.agent.core.context.tag.Tags; + +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 DB_TYPE = "Elasticsearch"; + + public static final String BASE_FUTURE_METHOD = "actionGet"; + + //tags + public static final AbstractTag<String> ES_TOOK_MILLIS = Tags.ofKey("es.took_millis"); + public static final AbstractTag<String> ES_TOTAL_HITS = Tags.ofKey("es.total_hits"); + public static final AbstractTag<String> ES_INGEST_TOOK_MILLIS = Tags.ofKey("es.ingest_took_millis"); +} diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/ElasticsearchPluginConfig.java b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/ElasticsearchPluginConfig.java new file mode 100644 index 000000000..2b9c375b1 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/ElasticsearchPluginConfig.java @@ -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 org.apache.skywalking.apm.plugin.elasticsearch.v7; + +import org.apache.skywalking.apm.agent.core.boot.PluginConfig; + +public class ElasticsearchPluginConfig { + public static class Plugin { + @PluginConfig(root = ElasticsearchPluginConfig.class) + public static class Elasticsearch { + /** + * If true, trace all the DSL(Domain Specific Language) in ElasticSearch access, default is false + */ + public static boolean TRACE_DSL = false; + + public static int ELASTICSEARCH_DSL_LENGTH_THRESHOLD = 1024; + } + } +} diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/define/AdapterActionFutureInstrumentation.java b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/define/AdapterActionFutureInstrumentation.java index 927ec5f3c..751738c96 100644 --- a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/define/AdapterActionFutureInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/define/AdapterActionFutureInstrumentation.java @@ -18,8 +18,6 @@ package org.apache.skywalking.apm.plugin.elasticsearch.v7.define; -import java.util.Collections; -import java.util.List; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod; @@ -28,7 +26,10 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsIn import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine; import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants; +import org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants; + +import java.util.Collections; +import java.util.List; import static net.bytebuddy.matcher.ElementMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.returns; diff --git a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/interceptor/AdapterActionFutureActionGetMethodsInterceptor.java b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/interceptor/AdapterActionFutureActionGetMethodsInterceptor.java index 47f0b8d10..b9e3b6bb4 100644 --- a/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/interceptor/AdapterActionFutureActionGetMethodsInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/elasticsearch-7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v7/interceptor/AdapterActionFutureActionGetMethodsInterceptor.java @@ -18,7 +18,6 @@ package org.apache.skywalking.apm.plugin.elasticsearch.v7.interceptor; -import java.lang.reflect.Method; import org.apache.skywalking.apm.agent.core.context.ContextManager; import org.apache.skywalking.apm.agent.core.context.tag.Tags; import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; @@ -26,7 +25,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedI import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; -import org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants; +import org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants; import org.apache.skywalking.apm.util.StringUtil; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.bulk.BulkResponse; @@ -36,8 +35,10 @@ import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.update.UpdateResponse; -import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.ELASTICSEARCH_DSL_LENGTH_THRESHOLD; -import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL; +import java.lang.reflect.Method; + +import static org.apache.skywalking.apm.plugin.elasticsearch.v7.ElasticsearchPluginConfig.Plugin.Elasticsearch.ELASTICSEARCH_DSL_LENGTH_THRESHOLD; +import static org.apache.skywalking.apm.plugin.elasticsearch.v7.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL; public class AdapterActionFutureActionGetMethodsInterceptor implements InstanceMethodsAroundInterceptor {