Optimize ElasticSearch 6.x 7.x plugin compatibility (#607)
This commit is contained in:
parent
bc7447a2c2
commit
44b8f669a9
|
|
@ -6,6 +6,7 @@ Release Notes.
|
|||
------------------
|
||||
|
||||
* Fix hbase onConstruct NPE in the file configuration scenario
|
||||
* Optimize ElasticSearch 6.x 7.x plugin compatibility
|
||||
|
||||
#### Documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>elasticsearch-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.skywalking.apm.plugin.elasticsearch.v6.define;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
|
|
@ -56,7 +57,8 @@ public class IndicesClientInstrumentation extends ClassEnhancePluginDefine {
|
|||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("create").or(named("createAsync"));
|
||||
return named("create").or(named("createAsync"))
|
||||
.and(takesArgument(0, named(Constants.CREATE_INDEX_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,7 +74,8 @@ public class IndicesClientInstrumentation extends ClassEnhancePluginDefine {
|
|||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("delete").or(named("deleteAsync"));
|
||||
return named("delete").or(named("deleteAsync"))
|
||||
.and(takesArgument(0, named(Constants.DELETE_INDEX_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -88,7 +91,8 @@ public class IndicesClientInstrumentation extends ClassEnhancePluginDefine {
|
|||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("analyze").or(named("analyzeAsync"));
|
||||
return named("analyze").or(named("analyzeAsync"))
|
||||
.and(takesArgument(0, named(Constants.ANALYZE_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -100,7 +104,24 @@ public class IndicesClientInstrumentation extends ClassEnhancePluginDefine {
|
|||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("refresh").or(named("refreshAsync"))
|
||||
.and(takesArgument(0, named(Constants.REFRESH_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return Constants.INDICES_CLIENT_REFRESH_METHODS_INTERCEPTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -108,4 +129,14 @@ public class IndicesClientInstrumentation extends ClassEnhancePluginDefine {
|
|||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] witnessClasses() {
|
||||
return new String[] {
|
||||
Constants.ANALYZE_REQUEST_WITNESS_CLASS,
|
||||
Constants.CREATE_INDEX_REQUEST_WITNESS_CLASS,
|
||||
Constants.DELETE_INDEX_REQUEST_WITNESS_CLASS,
|
||||
Constants.REFRESH_REQUEST_WITNESS_CLASS
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
|||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||
import static org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +59,7 @@ public class RestHighLevelClientInstrumentation extends ClassEnhancePluginDefine
|
|||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
return takesArguments(1);
|
||||
return takesArgument(0, named("org.elasticsearch.client.RestClient"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -74,22 +73,6 @@ public class RestHighLevelClientInstrumentation extends ClassEnhancePluginDefine
|
|||
@Override
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("performRequestAndParseEntity").and(takesArgumentWithType(0, "org.elasticsearch.client.indices.CreateIndexRequest"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return Constants.INDICES_CLIENT_CREATE_METHODS_INTERCEPTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.apache.skywalking.apm.plugin.elasticsearch.v6.define;
|
|||
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import net.bytebuddy.matcher.ElementMatchers;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
|
|
@ -27,25 +28,38 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnha
|
|||
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.any;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
public class TransportActionNodeProxyInstrumentation extends ClassEnhancePluginDefine {
|
||||
|
||||
public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.TransportActionNodeProxyExecuteMethodsInterceptor";
|
||||
public static final String THREE_ARGS_CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.TransportActionNodeProxyThreeArgsConstructorInterceptor";
|
||||
public static final String TWO_ARGS_CONSTRUCTOR2_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.TransportActionNodeProxyTwoArgsConstructorInterceptor";
|
||||
public static final String ENHANC_CLASS = "org.elasticsearch.action.TransportActionNodeProxy";
|
||||
public static final String CONSTRUCTOR_ARG_CLASS = "org.elasticsearch.transport.TransportService";
|
||||
|
||||
@Override
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[]{
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
return any();
|
||||
return ElementMatchers.takesArgument(2, named(CONSTRUCTOR_ARG_CLASS));
|
||||
}
|
||||
|
||||
@Override public String getConstructorInterceptor() {
|
||||
return INTERCEPTOR_CLASS;
|
||||
return THREE_ARGS_CONSTRUCTOR_INTERCEPTOR_CLASS;
|
||||
}
|
||||
},
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
return ElementMatchers.takesArgument(1, named(CONSTRUCTOR_ARG_CLASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConstructorInterceptor() {
|
||||
return TWO_ARGS_CONSTRUCTOR2_INTERCEPTOR_CLASS;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class Constants {
|
|||
public static final String INDICES_CLIENT_CREATE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.IndicesClientCreateMethodsInterceptor";
|
||||
public static final String INDICES_CLIENT_DELETE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.IndicesClientDeleteMethodsInterceptor";
|
||||
public static final String INDICES_CLIENT_ANALYZE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.IndicesClientAnalyzeMethodsInterceptor";
|
||||
public static final String INDICES_CLIENT_REFRESH_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.IndicesClientRefreshMethodsInterceptor";
|
||||
public static final String REST_HIGH_LEVEL_CLIENT_SEARCH_SCROLL_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.RestHighLevelClientSearchScrollMethodsInterceptor";
|
||||
public static final String REST_HIGH_LEVEL_CLIENT_SEARCH_TEMPLATE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.RestHighLevelClientSearchTemplateMethodsInterceptor";
|
||||
public static final String REST_HIGH_LEVEL_CLIENT_CLEAR_SCROLL_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.RestHighLevelClientClearScrollMethodsInterceptor";
|
||||
|
|
@ -45,11 +46,16 @@ public class Constants {
|
|||
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";
|
||||
public static final String CREATE_INDEX_REQUEST_WITNESS_CLASS = "org.elasticsearch.client.indices.CreateIndexRequest";
|
||||
public static final String DELETE_INDEX_REQUEST_WITNESS_CLASS = "org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest";
|
||||
public static final String ANALYZE_REQUEST_WITNESS_CLASS = "org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest";
|
||||
public static final String REFRESH_REQUEST_WITNESS_CLASS = "org.elasticsearch.action.admin.indices.refresh.RefreshRequest";
|
||||
|
||||
//es operator name
|
||||
public static final String CREATE_OPERATOR_NAME = "Elasticsearch/CreateRequest";
|
||||
public static final String DELETE_OPERATOR_NAME = "Elasticsearch/DeleteRequest";
|
||||
public static final String ANALYZE_OPERATOR_NAME = "Elasticsearch/AnalyzeRequest";
|
||||
public static final String REFRESH_OPERATOR_NAME = "Elasticsearch/RefreshRequest";
|
||||
public static final String GET_OPERATOR_NAME = "Elasticsearch/GetRequest";
|
||||
public static final String INDEX_OPERATOR_NAME = "Elasticsearch/IndexRequest";
|
||||
public static final String SEARCH_OPERATOR_NAME = "Elasticsearch/SearchRequest";
|
||||
|
|
|
|||
|
|
@ -23,11 +23,13 @@ import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
|||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
@ -36,6 +38,7 @@ import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPlu
|
|||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
|
||||
|
||||
public class IndicesClientAnalyzeMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
private static final ILog LOGGER = LogManager.getLogger(IndicesClientAnalyzeMethodsInterceptor.class);
|
||||
|
||||
private static final AbstractTag<String> ANALYZER_TAG = Tags.ofKey("analyzer");
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* 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.v6.interceptor;
|
||||
|
||||
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;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
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.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE;
|
||||
|
||||
public class IndicesClientRefreshMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
RefreshRequest request = (RefreshRequest) (allArguments[0]);
|
||||
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
AbstractSpan span = ContextManager.createExitSpan(Constants.REFRESH_OPERATOR_NAME, restClientEnhanceInfo.getPeers());
|
||||
span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);
|
||||
|
||||
Tags.DB_TYPE.set(span, DB_TYPE);
|
||||
Tags.DB_INSTANCE.set(span, buildIndicesString(request.indices()));
|
||||
SpanLayer.asDB(span);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildIndicesString(String[] indices) {
|
||||
if (indices == null || indices.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int n = indices.length;
|
||||
for (int i = 0; i < n; i++) {
|
||||
sb.append(indices[i]);
|
||||
if (i < n - 1) {
|
||||
sb.append(',');
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.stopSpan();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.search.ClearScrollRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
|||
|
|
@ -18,17 +18,15 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.client.Node;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestClientBuilder;
|
||||
|
||||
public class RestHighLevelClientConInterceptor implements InstanceConstructorInterceptor {
|
||||
|
||||
|
|
@ -36,19 +34,13 @@ public class RestHighLevelClientConInterceptor implements InstanceConstructorInt
|
|||
|
||||
@Override
|
||||
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
|
||||
RestClientBuilder restClientBuilder = (RestClientBuilder) allArguments[0];
|
||||
RestClient restClient = restClientBuilder.build();
|
||||
RestClient restClient = (RestClient) allArguments[0];
|
||||
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = new RestClientEnhanceInfo();
|
||||
List<Node> nodeList = restClient.getNodes();
|
||||
for (Node node : nodeList) {
|
||||
restClientEnhanceInfo.addHttpHost(node.getHost());
|
||||
restClientEnhanceInfo.addHttpHost(node.getHost().getHostName(), node.getHost().getPort());
|
||||
}
|
||||
objInst.setSkyWalkingDynamicField(restClientEnhanceInfo);
|
||||
try {
|
||||
restClient.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("close restClient error , error message is " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.search.SearchScrollRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.script.mustache.SearchTemplateRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,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.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
|||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
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;
|
||||
|
|
@ -41,7 +40,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v6.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
|
||||
public class TransportActionNodeProxyExecuteMethodsInterceptor implements InstanceConstructorInterceptor, InstanceMethodsAroundInterceptor {
|
||||
public class TransportActionNodeProxyExecuteMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
|
|
@ -74,12 +73,6 @@ public class TransportActionNodeProxyExecuteMethodsInterceptor implements Instan
|
|||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
|
||||
EnhancedInstance actions = (EnhancedInstance) allArguments[2];
|
||||
objInst.setSkyWalkingDynamicField(actions.getSkyWalkingDynamicField());
|
||||
}
|
||||
|
||||
private void parseRequestInfo(ActionRequest request, AbstractSpan span) {
|
||||
// search request
|
||||
if (request instanceof SearchRequest) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
|
||||
public class TransportActionNodeProxyThreeArgsConstructorInterceptor implements InstanceConstructorInterceptor {
|
||||
|
||||
@Override
|
||||
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) throws Throwable {
|
||||
// (Settings settings, GenericAction<Request, Response> action, TransportService transportService)
|
||||
EnhancedInstance actions = (EnhancedInstance) allArguments[2];
|
||||
objInst.setSkyWalkingDynamicField(actions.getSkyWalkingDynamicField());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
|
||||
public class TransportActionNodeProxyTwoArgsConstructorInterceptor implements InstanceConstructorInterceptor {
|
||||
|
||||
@Override
|
||||
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) throws Throwable {
|
||||
// after 7.11 version
|
||||
// (ActionType<Response> action, TransportService transportService)
|
||||
EnhancedInstance actions = (EnhancedInstance) allArguments[1];
|
||||
objInst.setSkyWalkingDynamicField(actions.getSkyWalkingDynamicField());
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.junit.Assert;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.junit.Assert;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.search.ClearScrollRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@ import java.util.List;
|
|||
import org.apache.http.HttpHost;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.client.Node;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestClientBuilder;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
|
@ -42,9 +41,6 @@ public class RestHighLevelClientConInterceptorTest {
|
|||
@Rule
|
||||
public MockitoRule rule = MockitoJUnit.rule();
|
||||
|
||||
@Mock
|
||||
private RestClientBuilder restClientBuilder;
|
||||
|
||||
@Mock
|
||||
private RestClient restClient;
|
||||
|
||||
|
|
@ -58,9 +54,8 @@ public class RestHighLevelClientConInterceptorTest {
|
|||
nodeList.add(new Node(new HttpHost("127.0.0.1", 9200)));
|
||||
nodeList.add(new Node(new HttpHost("127.0.0.1", 9300)));
|
||||
restHighLevelClientConInterceptor = new RestHighLevelClientConInterceptor();
|
||||
when(restClientBuilder.build()).thenReturn(restClient);
|
||||
when(restClient.getNodes()).thenReturn(nodeList);
|
||||
allArguments = new Object[] {restClientBuilder};
|
||||
allArguments = new Object[] {restClient};
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.search.SearchScrollRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.script.mustache.SearchTemplateRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.common.RestClientEnhanceInfo;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class TransportActionNodeProxyExecuteMethodsInterceptorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConstruct() {
|
||||
public void testConstruct() throws Throwable {
|
||||
|
||||
final EnhancedInstance objInst1 = new EnhancedInstance() {
|
||||
private Object object = null;
|
||||
|
|
@ -158,7 +158,8 @@ public class TransportActionNodeProxyExecuteMethodsInterceptorTest {
|
|||
objInst1
|
||||
};
|
||||
|
||||
interceptor.onConstruct(objInst2, allArguments);
|
||||
TransportActionNodeProxyThreeArgsConstructorInterceptor constructorInterceptor = new TransportActionNodeProxyThreeArgsConstructorInterceptor();
|
||||
constructorInterceptor.onConstruct(objInst2, allArguments);
|
||||
assertThat(objInst1.getSkyWalkingDynamicField(), is(objInst2.getSkyWalkingDynamicField()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,16 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<elasticsearch.rest.high.level.client.version>7.2.1</elasticsearch.rest.high.level.client.version>
|
||||
<elasticsearch.rest.high.level.client.version>7.17.12</elasticsearch.rest.high.level.client.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>elasticsearch-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
|
|
|
|||
|
|
@ -23,13 +23,27 @@ import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
|||
|
||||
public class Constants {
|
||||
|
||||
public static final String INDICES_CLIENT_CREATE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v7.interceptor.IndicesClientCreateMethodsInterceptor";
|
||||
public static final String INDICES_CLIENT_DELETE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v7.interceptor.IndicesClientDeleteMethodsInterceptor";
|
||||
public static final String INDICES_CLIENT_ANALYZE_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v7.interceptor.IndicesClientAnalyzeMethodsInterceptor";
|
||||
public static final String INDICES_CLIENT_REFRESH_METHODS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v7.interceptor.IndicesClientRefreshMethodsInterceptor";
|
||||
|
||||
//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_REQUEST_WITNESS_CLASS = "org.elasticsearch.client.indices.CreateIndexRequest";
|
||||
public static final String DELETE_INDEX_REQUEST_WITNESS_CLASS = "org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest";
|
||||
public static final String ANALYZE_REQUEST_WITNESS_CLASS = "org.elasticsearch.client.indices.AnalyzeRequest";
|
||||
public static final String REFRESH_REQUEST_WITNESS_CLASS = "org.elasticsearch.action.admin.indices.refresh.RefreshRequest";
|
||||
public static final String DB_TYPE = "Elasticsearch";
|
||||
|
||||
public static final String BASE_FUTURE_METHOD = "actionGet";
|
||||
|
||||
public static final String CREATE_OPERATOR_NAME = "Elasticsearch/CreateRequest";
|
||||
public static final String DELETE_OPERATOR_NAME = "Elasticsearch/DeleteRequest";
|
||||
public static final String ANALYZE_OPERATOR_NAME = "Elasticsearch/AnalyzeRequest";
|
||||
public static final String REFRESH_OPERATOR_NAME = "Elasticsearch/RefreshRequest";
|
||||
|
||||
//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");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* 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.define;
|
||||
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
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.v7.Constants;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
|
||||
|
||||
public class IndicesClientInstrumentation extends ClassEnhancePluginDefine {
|
||||
|
||||
public static final String ENHANCE_CLASS = "org.elasticsearch.client.IndicesClient";
|
||||
|
||||
@Override
|
||||
protected ClassMatch enhanceClass() {
|
||||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("create").or(named("createAsync"))
|
||||
.and(takesArgument(0, named(Constants.CREATE_INDEX_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return Constants.INDICES_CLIENT_CREATE_METHODS_INTERCEPTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("delete").or(named("deleteAsync"))
|
||||
.and(takesArgument(0, named(Constants.DELETE_INDEX_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return Constants.INDICES_CLIENT_DELETE_METHODS_INTERCEPTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("analyze").or(named("analyzeAsync"))
|
||||
.and(takesArgument(0, named(Constants.ANALYZE_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return Constants.INDICES_CLIENT_ANALYZE_METHODS_INTERCEPTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named("refresh").or(named("refreshAsync"))
|
||||
.and(takesArgument(0, named(Constants.REFRESH_REQUEST_WITNESS_CLASS)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return Constants.INDICES_CLIENT_REFRESH_METHODS_INTERCEPTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] witnessClasses() {
|
||||
return new String[] {
|
||||
Constants.ANALYZE_REQUEST_WITNESS_CLASS,
|
||||
Constants.CREATE_INDEX_REQUEST_WITNESS_CLASS,
|
||||
Constants.DELETE_INDEX_REQUEST_WITNESS_CLASS,
|
||||
Constants.REFRESH_REQUEST_WITNESS_CLASS
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,8 @@ package org.apache.skywalking.apm.plugin.elasticsearch.v7.interceptor;
|
|||
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;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
|
|
@ -35,12 +37,17 @@ import org.elasticsearch.action.index.IndexResponse;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
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 {
|
||||
private static final ILog LOGGER = LogManager.getLogger(AdapterActionFutureActionGetMethodsInterceptor.class);
|
||||
|
||||
private static final Field SEARCH_RESPONSE_TOOK_FIELD = getTookField(SearchResponse.class);
|
||||
private static final Field BULK_RESPONSE_TOOK_FIELD = getTookField(BulkResponse.class);
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
|
|
@ -111,7 +118,7 @@ public class AdapterActionFutureActionGetMethodsInterceptor implements InstanceM
|
|||
}
|
||||
|
||||
private void parseSearchResponse(SearchResponse searchResponse, AbstractSpan span) {
|
||||
span.tag(Constants.ES_TOOK_MILLIS, Long.toString(searchResponse.getTook().getMillis()));
|
||||
tagEsTookMillis(SEARCH_RESPONSE_TOOK_FIELD, searchResponse, span);
|
||||
span.tag(Constants.ES_TOTAL_HITS, Long.toString(searchResponse.getHits().getTotalHits().value));
|
||||
if (TRACE_DSL) {
|
||||
String tagValue = searchResponse.toString();
|
||||
|
|
@ -121,7 +128,7 @@ public class AdapterActionFutureActionGetMethodsInterceptor implements InstanceM
|
|||
}
|
||||
|
||||
private void parseBulkResponse(BulkResponse bulkResponse, AbstractSpan span) {
|
||||
span.tag(Constants.ES_TOOK_MILLIS, Long.toString(bulkResponse.getTook().getMillis()));
|
||||
tagEsTookMillis(BULK_RESPONSE_TOOK_FIELD, bulkResponse, span);
|
||||
span.tag(Constants.ES_INGEST_TOOK_MILLIS, Long.toString(bulkResponse.getIngestTookInMillis()));
|
||||
if (TRACE_DSL) {
|
||||
String tagValue = bulkResponse.toString();
|
||||
|
|
@ -130,6 +137,17 @@ public class AdapterActionFutureActionGetMethodsInterceptor implements InstanceM
|
|||
}
|
||||
}
|
||||
|
||||
private void tagEsTookMillis(Field field, Object obj, AbstractSpan span) {
|
||||
if (field == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
span.tag(Constants.ES_TOOK_MILLIS, Long.toString(field.getLong(obj)));
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("get tookInMillis", t);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseGetResponse(GetResponse getResponse, AbstractSpan span) {
|
||||
if (TRACE_DSL) {
|
||||
String tagValue = getResponse.toString();
|
||||
|
|
@ -161,4 +179,15 @@ public class AdapterActionFutureActionGetMethodsInterceptor implements InstanceM
|
|||
Tags.DB_STATEMENT.set(span, tagValue);
|
||||
}
|
||||
}
|
||||
|
||||
private static Field getTookField(Class<?> clazz) {
|
||||
try {
|
||||
Field field = clazz.getDeclaredField("tookInMillis");
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("get tookInMillis field failed", t);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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.interceptor;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
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.common.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants;
|
||||
import org.elasticsearch.client.indices.AnalyzeRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v7.ElasticsearchPluginConfig.Plugin.Elasticsearch.TRACE_DSL;
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants.DB_TYPE;
|
||||
|
||||
public class IndicesClientAnalyzeMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
private static final ILog LOGGER = LogManager.getLogger(IndicesClientAnalyzeMethodsInterceptor.class);
|
||||
|
||||
private static final AbstractTag<String> ANALYZER_TAG = Tags.ofKey("analyzer");
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
AnalyzeRequest analyzeRequest = (AnalyzeRequest) allArguments[0];
|
||||
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
AbstractSpan span = ContextManager.createExitSpan(Constants.ANALYZE_OPERATOR_NAME, restClientEnhanceInfo.getPeers());
|
||||
span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);
|
||||
|
||||
Tags.DB_TYPE.set(span, DB_TYPE);
|
||||
span.tag(ANALYZER_TAG, analyzeRequest.analyzer());
|
||||
if (TRACE_DSL) {
|
||||
Tags.DB_STATEMENT.set(span, analyzeRequest.text()[0]);
|
||||
}
|
||||
SpanLayer.asDB(span);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.stopSpan();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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.interceptor;
|
||||
|
||||
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;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
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.common.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants;
|
||||
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants.DB_TYPE;
|
||||
|
||||
public class IndicesClientCreateMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
CreateIndexRequest createIndexRequest = (CreateIndexRequest) (allArguments[0]);
|
||||
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
AbstractSpan span = ContextManager.createExitSpan(Constants.CREATE_OPERATOR_NAME, restClientEnhanceInfo.getPeers());
|
||||
span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);
|
||||
|
||||
Tags.DB_TYPE.set(span, DB_TYPE);
|
||||
Tags.DB_INSTANCE.set(span, createIndexRequest.index());
|
||||
SpanLayer.asDB(span);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.stopSpan();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.interceptor;
|
||||
|
||||
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;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
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.common.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants.DB_TYPE;
|
||||
|
||||
public class IndicesClientDeleteMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
DeleteIndexRequest deleteIndexRequest = (DeleteIndexRequest) allArguments[0];
|
||||
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
AbstractSpan span = ContextManager.createExitSpan(Constants.DELETE_OPERATOR_NAME, restClientEnhanceInfo.getPeers());
|
||||
span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);
|
||||
|
||||
Tags.DB_TYPE.set(span, DB_TYPE);
|
||||
Tags.DB_INSTANCE.set(span, Arrays.asList(deleteIndexRequest.indices()).toString());
|
||||
SpanLayer.asDB(span);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.stopSpan();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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.interceptor;
|
||||
|
||||
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;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
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.common.RestClientEnhanceInfo;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.elasticsearch.v7.Constants.DB_TYPE;
|
||||
|
||||
public class IndicesClientRefreshMethodsInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
RefreshRequest request = (RefreshRequest) (allArguments[0]);
|
||||
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (restClientEnhanceInfo != null) {
|
||||
AbstractSpan span = ContextManager.createExitSpan(Constants.REFRESH_OPERATOR_NAME, restClientEnhanceInfo.getPeers());
|
||||
span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);
|
||||
|
||||
Tags.DB_TYPE.set(span, DB_TYPE);
|
||||
Tags.DB_INSTANCE.set(span, buildIndicesString(request.indices()));
|
||||
SpanLayer.asDB(span);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildIndicesString(String[] indices) {
|
||||
if (indices == null || indices.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int n = indices.length;
|
||||
for (int i = 0; i < n; i++) {
|
||||
sb.append(indices[i]);
|
||||
if (i < n - 1) {
|
||||
sb.append(',');
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.stopSpan();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
|
||||
if (restClientEnhanceInfo != null) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,3 +15,4 @@
|
|||
# limitations under the License.
|
||||
|
||||
elasticsearch-7.x=org.apache.skywalking.apm.plugin.elasticsearch.v7.define.AdapterActionFutureInstrumentation
|
||||
elasticsearch-7.x=org.apache.skywalking.apm.plugin.elasticsearch.v7.define.IndicesClientInstrumentation
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?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">
|
||||
<parent>
|
||||
<artifactId>apm-sdk-plugin</artifactId>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<version>9.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>elasticsearch-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>elasticsearch-common</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
</project>
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.v6;
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.common;
|
||||
|
||||
/**
|
||||
* Used for store ES connection related information, remotePeers will store the IP address and port, separated by commas
|
||||
|
|
@ -16,16 +16,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.v6;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.common;
|
||||
|
||||
public class RestClientEnhanceInfo {
|
||||
|
||||
private RemotePeerCache remotePeerCache = new RemotePeerCache();
|
||||
|
||||
public void addHttpHost(HttpHost httpHost) {
|
||||
remotePeerCache.addRemotePeer(httpHost.getHostName(), httpHost.getPort());
|
||||
public void addHttpHost(String hostName, int port) {
|
||||
remotePeerCache.addRemotePeer(hostName, port);
|
||||
}
|
||||
|
||||
public String getPeers() {
|
||||
|
|
@ -66,6 +66,7 @@
|
|||
<module>hystrix-1.x-plugin</module>
|
||||
<module>sofarpc-plugin</module>
|
||||
<module>activemq-5.x-plugin</module>
|
||||
<module>elasticsearch-common</module>
|
||||
<module>elasticsearch-5.x-plugin</module>
|
||||
<module>elasticsearch-6.x-plugin</module>
|
||||
<module>elasticsearch-7.x-plugin</module>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ segmentItems:
|
|||
tags:
|
||||
- { key: db.type, value: Elasticsearch }
|
||||
- { key: db.instance, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/IndexRequest
|
||||
parentSpanId: 0
|
||||
|
|
@ -89,7 +88,7 @@ segmentItems:
|
|||
- { key: db.instance, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/GetRequest
|
||||
- operationName: Elasticsearch/RefreshRequest
|
||||
parentSpanId: 0
|
||||
spanId: 6
|
||||
spanLayer: Database
|
||||
|
|
@ -102,9 +101,8 @@ segmentItems:
|
|||
tags:
|
||||
- { key: db.type, value: Elasticsearch }
|
||||
- { key: db.instance, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
- operationName: Elasticsearch/GetRequest
|
||||
parentSpanId: 0
|
||||
spanId: 7
|
||||
spanLayer: Database
|
||||
|
|
@ -119,7 +117,7 @@ segmentItems:
|
|||
- { key: db.instance, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/UpdateRequest
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 8
|
||||
spanLayer: Database
|
||||
|
|
@ -134,7 +132,7 @@ segmentItems:
|
|||
- { key: db.instance, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteRequest
|
||||
- operationName: Elasticsearch/UpdateRequest
|
||||
parentSpanId: 0
|
||||
spanId: 9
|
||||
spanLayer: Database
|
||||
|
|
@ -147,38 +145,38 @@ segmentItems:
|
|||
tags:
|
||||
- { key: db.type, value: Elasticsearch }
|
||||
- { key: db.instance, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/IndexRequest
|
||||
- operationName: Elasticsearch/AnalyzeRequest
|
||||
parentSpanId: 0
|
||||
spanId: 10
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 48
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- { key: db.type, value: Elasticsearch }
|
||||
- { key: analyzer, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteRequest
|
||||
parentSpanId: 0
|
||||
spanId: 11
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
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: 11
|
||||
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
|
||||
- operationName: Elasticsearch/IndexRequest
|
||||
parentSpanId: 0
|
||||
spanId: 12
|
||||
spanLayer: Database
|
||||
|
|
@ -196,9 +194,21 @@ segmentItems:
|
|||
- { key: es.types, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
- operationName: Elasticsearch/actionGet
|
||||
parentSpanId: 0
|
||||
spanId: 13
|
||||
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: 14
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
@ -214,21 +224,7 @@ segmentItems:
|
|||
- { key: es.types, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/actionGet
|
||||
parentSpanId: 0
|
||||
spanId: 14
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 48
|
||||
isError: false
|
||||
spanType: Local
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: es.took_millis, value: not null }
|
||||
- {key: es.total_hits, value: not null }
|
||||
- {key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/UpdateRequest
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 15
|
||||
spanLayer: Database
|
||||
|
|
@ -246,9 +242,41 @@ segmentItems:
|
|||
- { key: es.types, value: not null }
|
||||
- { key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteRequest
|
||||
- operationName: Elasticsearch/actionGet
|
||||
parentSpanId: 0
|
||||
spanId: 16
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 48
|
||||
isError: false
|
||||
spanType: Local
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: es.took_millis, value: not null }
|
||||
- {key: es.total_hits, value: not null }
|
||||
- {key: db.statement, value: not null }
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/UpdateRequest
|
||||
parentSpanId: 0
|
||||
spanId: 17
|
||||
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: 18
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
@ -266,7 +294,7 @@ segmentItems:
|
|||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteIndexRequest
|
||||
parentSpanId: 0
|
||||
spanId: 17
|
||||
spanId: 19
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.skywalking.apm.testcase.elasticsearch;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
|
@ -43,14 +44,13 @@ import org.elasticsearch.action.update.UpdateRequest;
|
|||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.indices.AnalyzeRequest;
|
||||
import org.elasticsearch.client.indices.AnalyzeResponse;
|
||||
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||
import org.elasticsearch.client.indices.CreateIndexResponse;
|
||||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.indices.recovery.RecoverySettings;
|
||||
import org.elasticsearch.script.Script;
|
||||
|
|
@ -71,7 +71,7 @@ public class RestHighLevelClientCase {
|
|||
|
||||
public String healthCheck() throws Exception {
|
||||
ClusterHealthRequest request = new ClusterHealthRequest();
|
||||
request.timeout(TimeValue.timeValueSeconds(10));
|
||||
request.timeout("10s");
|
||||
request.waitForStatus(ClusterHealthStatus.GREEN);
|
||||
|
||||
ClusterHealthResponse response = client.cluster().health(request, RequestOptions.DEFAULT);
|
||||
|
|
@ -101,6 +101,7 @@ public class RestHighLevelClientCase {
|
|||
// index
|
||||
index(indexName);
|
||||
|
||||
// refresh
|
||||
client.indices().refresh(new RefreshRequest(indexName), RequestOptions.DEFAULT);
|
||||
|
||||
// get
|
||||
|
|
@ -112,6 +113,9 @@ public class RestHighLevelClientCase {
|
|||
// update
|
||||
update(indexName);
|
||||
|
||||
// analyze
|
||||
analyze(indexName);
|
||||
|
||||
// delete
|
||||
delete(indexName);
|
||||
} finally {
|
||||
|
|
@ -164,27 +168,16 @@ public class RestHighLevelClientCase {
|
|||
|
||||
private void createIndex(String indexName) throws IOException {
|
||||
CreateIndexRequest request = new CreateIndexRequest(indexName);
|
||||
|
||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||
builder.startObject();
|
||||
{
|
||||
builder.startObject("properties");
|
||||
{
|
||||
builder.startObject("author");
|
||||
{
|
||||
builder.field("type", "keyword");
|
||||
}
|
||||
builder.endObject();
|
||||
builder.startObject("title");
|
||||
{
|
||||
builder.field("type", "keyword");
|
||||
}
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
request.mapping(builder);
|
||||
Map<String, Object> mapping = new HashMap<>();
|
||||
Map<String, Object> mappingProperties = new HashMap<>();
|
||||
Map<String, String> mappingPropertiesAuthor = new HashMap<>();
|
||||
mappingPropertiesAuthor.put("type", "keyword");
|
||||
mappingProperties.put("author", mappingPropertiesAuthor);
|
||||
Map<String, String> mappingPropertiesTitle = new HashMap<>();
|
||||
mappingPropertiesTitle.put("type", "keyword");
|
||||
mappingProperties.put("title", mappingPropertiesTitle);
|
||||
mapping.put("properties", mappingProperties);
|
||||
request.mapping(mapping);
|
||||
|
||||
request.settings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0));
|
||||
|
||||
|
|
@ -197,14 +190,10 @@ public class RestHighLevelClientCase {
|
|||
}
|
||||
|
||||
private void index(String indexName) throws IOException {
|
||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||
builder.startObject();
|
||||
{
|
||||
builder.field("author", "Marker");
|
||||
builder.field("title", "Java programing.");
|
||||
}
|
||||
builder.endObject();
|
||||
IndexRequest indexRequest = new IndexRequest(indexName).id("1").source(builder);
|
||||
Map<String, String> source = new HashMap<>();
|
||||
source.put("author", "Marker");
|
||||
source.put("title", "Java programing.");
|
||||
IndexRequest indexRequest = new IndexRequest(indexName).id("1").source(source);
|
||||
|
||||
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
|
||||
if (indexResponse.status().getStatus() >= 400) {
|
||||
|
|
@ -239,6 +228,16 @@ public class RestHighLevelClientCase {
|
|||
}
|
||||
}
|
||||
|
||||
private void analyze(String indexName) throws IOException {
|
||||
AnalyzeRequest analyzeRequest = AnalyzeRequest.withIndexAnalyzer(indexName, null, "SkyWalking");
|
||||
AnalyzeResponse analyzeResponse = client.indices().analyze(analyzeRequest, RequestOptions.DEFAULT);
|
||||
if (null == analyzeResponse.getTokens() || analyzeResponse.getTokens().size() < 1) {
|
||||
String message = "elasticsearch analyze index fail.";
|
||||
LOGGER.error(message);
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void delete(String indexName) throws IOException {
|
||||
DeleteIndexRequest request = new DeleteIndexRequest(indexName);
|
||||
AcknowledgedResponse deleteIndexResponse = client.indices().delete(request, RequestOptions.DEFAULT);
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
package org.apache.skywalking.apm.testcase.elasticsearch;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -61,15 +62,14 @@ public class TransportClientCase {
|
|||
|
||||
private void index(Client client, String indexName) throws IOException {
|
||||
try {
|
||||
Map<String, String> source = new HashMap<>();
|
||||
source.put("name", "mysql innodb");
|
||||
source.put("price", "0");
|
||||
source.put("language", "chinese");
|
||||
client.prepareIndex(indexName, "test", "1")
|
||||
.setSource(XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
.field("name", "mysql innodb")
|
||||
.field("price", "0")
|
||||
.field("language", "chinese")
|
||||
.endObject())
|
||||
.setSource(source)
|
||||
.get();
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("index document error.", e);
|
||||
throw e;
|
||||
}
|
||||
|
|
@ -82,9 +82,9 @@ public class TransportClientCase {
|
|||
private void update(Client client, String indexName) throws IOException {
|
||||
try {
|
||||
client.prepareUpdate(indexName, "test", "1")
|
||||
.setDoc(XContentFactory.jsonBuilder().startObject().field("price", "9.9").endObject())
|
||||
.setDoc("price", "9.9")
|
||||
.execute();
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("update document error.", e);
|
||||
throw e;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,17 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
7.0.0
|
||||
7.1.1
|
||||
7.2.1
|
||||
7.3.2
|
||||
7.4.2
|
||||
7.5.2
|
||||
7.6.2
|
||||
7.7.1
|
||||
7.8.1
|
||||
7.9.3
|
||||
7.10.1
|
||||
7.11.2
|
||||
7.12.1
|
||||
7.13.4
|
||||
7.14.2
|
||||
7.16.3
|
||||
7.17.12
|
||||
|
|
@ -49,7 +49,7 @@ segmentItems:
|
|||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/GetRequest
|
||||
- operationName: Elasticsearch/RefreshRequest
|
||||
parentSpanId: 0
|
||||
spanId: 3
|
||||
spanLayer: Database
|
||||
|
|
@ -60,11 +60,10 @@ segmentItems:
|
|||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
- operationName: Elasticsearch/GetRequest
|
||||
parentSpanId: 0
|
||||
spanId: 4
|
||||
spanLayer: Database
|
||||
|
|
@ -78,6 +77,7 @@ segmentItems:
|
|||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 5
|
||||
|
|
@ -89,10 +89,10 @@ segmentItems:
|
|||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/SearchScrollRequest
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 6
|
||||
spanLayer: Database
|
||||
|
|
@ -102,13 +102,27 @@ segmentItems:
|
|||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/SearchScrollRequest
|
||||
parentSpanId: 0
|
||||
spanId: 7
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 7
|
||||
spanId: 8
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
@ -122,7 +136,7 @@ segmentItems:
|
|||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/SearchScrollRequest
|
||||
parentSpanId: 0
|
||||
spanId: 8
|
||||
spanId: 9
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
@ -135,20 +149,6 @@ segmentItems:
|
|||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 9
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/ClearScrollRequest
|
||||
parentSpanId: 0
|
||||
spanId: 10
|
||||
spanLayer: Database
|
||||
|
|
@ -158,13 +158,27 @@ segmentItems:
|
|||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/ClearScrollRequest
|
||||
parentSpanId: 0
|
||||
spanId: 11
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchRequest
|
||||
parentSpanId: 0
|
||||
spanId: 11
|
||||
spanId: 12
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
@ -178,7 +192,7 @@ segmentItems:
|
|||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/ClearScrollRequest
|
||||
parentSpanId: 0
|
||||
spanId: 12
|
||||
spanId: 13
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
|
|
@ -190,20 +204,6 @@ segmentItems:
|
|||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/SearchTemplateRequest
|
||||
parentSpanId: 0
|
||||
spanId: 13
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/SearchTemplateRequest
|
||||
parentSpanId: 0
|
||||
spanId: 14
|
||||
|
|
@ -218,7 +218,7 @@ segmentItems:
|
|||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/UpdateRequest
|
||||
- operationName: Elasticsearch/SearchTemplateRequest
|
||||
parentSpanId: 0
|
||||
spanId: 15
|
||||
spanLayer: Database
|
||||
|
|
@ -228,26 +228,25 @@ segmentItems:
|
|||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
- operationName: Elasticsearch/UpdateRequest
|
||||
parentSpanId: 0
|
||||
spanId: 16
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/AnalyzeRequest
|
||||
parentSpanId: 0
|
||||
spanId: 16
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: analyzer, value: ''}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/AnalyzeRequest
|
||||
parentSpanId: 0
|
||||
spanId: 17
|
||||
|
|
@ -260,10 +259,10 @@ segmentItems:
|
|||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: analyzer, value: ''}
|
||||
- {key: analyzer, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteByQueryRequest
|
||||
- operationName: Elasticsearch/AnalyzeRequest
|
||||
parentSpanId: 0
|
||||
spanId: 18
|
||||
spanLayer: Database
|
||||
|
|
@ -275,7 +274,7 @@ segmentItems:
|
|||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: analyzer, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteByQueryRequest
|
||||
|
|
@ -293,7 +292,7 @@ segmentItems:
|
|||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteRequest
|
||||
- operationName: Elasticsearch/DeleteByQueryRequest
|
||||
parentSpanId: 0
|
||||
spanId: 20
|
||||
spanLayer: Database
|
||||
|
|
@ -303,6 +302,21 @@ segmentItems:
|
|||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
- {key: db.statement, value: not null}
|
||||
skipAnalysis: 'false'
|
||||
- operationName: Elasticsearch/DeleteRequest
|
||||
parentSpanId: 0
|
||||
spanId: 21
|
||||
spanLayer: Database
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 77
|
||||
isError: false
|
||||
spanType: Exit
|
||||
peer: not null
|
||||
tags:
|
||||
- {key: db.type, value: Elasticsearch}
|
||||
- {key: db.instance, value: not null}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ public class RestHighLevelClientCase {
|
|||
// index
|
||||
index(client, indexName);
|
||||
|
||||
// refresh
|
||||
client.indices().refresh(new RefreshRequest(indexName), RequestOptions.DEFAULT);
|
||||
|
||||
//get
|
||||
|
|
|
|||
Loading…
Reference in New Issue