提交 53e86088 编写于 作者: wu-sheng's avatar wu-sheng

Merge branch 'master' into 6.0

# Conflicts:
#	.gitignore
#	LICENSE
#	README.md
#	README_ZH.md
#	apm-application-toolkit/apm-toolkit-log4j-1.x/pom.xml
#	apm-application-toolkit/apm-toolkit-log4j-2.x/pom.xml
#	apm-application-toolkit/apm-toolkit-logback-1.x/pom.xml
#	apm-application-toolkit/apm-toolkit-opentracing/pom.xml
#	apm-application-toolkit/apm-toolkit-trace/pom.xml
#	apm-application-toolkit/pom.xml
#	apm-checkstyle/pom.xml
#	apm-collector/apm-collector-agent/agent-grpc/agent-grpc-define/pom.xml
#	apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/pom.xml
#	apm-collector/apm-collector-agent/agent-grpc/pom.xml
#	apm-collector/apm-collector-agent/agent-jetty/agent-jetty-define/pom.xml
#	apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/pom.xml
#	apm-collector/apm-collector-agent/agent-jetty/pom.xml
#	apm-collector/apm-collector-agent/pom.xml
#	apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/pom.xml
#	apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/pom.xml
#	apm-collector/apm-collector-analysis/analysis-alarm/pom.xml
#	apm-collector/apm-collector-analysis/analysis-baseline/baseline-computing-define/pom.xml
#	apm-collector/apm-collector-analysis/analysis-baseline/baseline-computing-provider/pom.xml
#	apm-collector/apm-collector-analysis/analysis-baseline/pom.xml
#	apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/pom.xml
#	apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/pom.xml
#	apm-collector/apm-collector-analysis/analysis-jvm/pom.xml
#	apm-collector/apm-collector-analysis/analysis-metric/metric-define/pom.xml
#	apm-collector/apm-collector-analysis/analysis-metric/metric-provider/pom.xml
#	apm-collector/apm-collector-analysis/analysis-metric/pom.xml
#	apm-collector/apm-collector-analysis/analysis-register/pom.xml
#	apm-collector/apm-collector-analysis/analysis-register/register-define/pom.xml
#	apm-collector/apm-collector-analysis/analysis-register/register-provider/pom.xml
#	apm-collector/apm-collector-analysis/analysis-segment-parser/pom.xml
#	apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-define/pom.xml
#	apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/pom.xml
#	apm-collector/apm-collector-analysis/analysis-worker-model/pom.xml
#	apm-collector/apm-collector-analysis/pom.xml
#	apm-collector/apm-collector-boot/pom.xml
#	apm-collector/apm-collector-boot/src/main/resources/component-libraries.yml
#	apm-collector/apm-collector-cache/collector-cache-caffeine-provider/pom.xml
#	apm-collector/apm-collector-cache/collector-cache-define/pom.xml
#	apm-collector/apm-collector-cache/collector-cache-guava-provider/pom.xml
#	apm-collector/apm-collector-cache/pom.xml
#	apm-collector/apm-collector-cluster/collector-cluster-define/pom.xml
#	apm-collector/apm-collector-cluster/collector-cluster-redis-provider/pom.xml
#	apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/pom.xml
#	apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/pom.xml
#	apm-collector/apm-collector-cluster/pom.xml
#	apm-collector/apm-collector-component/client-component/pom.xml
#	apm-collector/apm-collector-component/pom.xml
#	apm-collector/apm-collector-component/server-component/pom.xml
#	apm-collector/apm-collector-configuration/collector-configuration-define/pom.xml
#	apm-collector/apm-collector-configuration/collector-configuration-provider/pom.xml
#	apm-collector/apm-collector-configuration/pom.xml
#	apm-collector/apm-collector-core/pom.xml
#	apm-collector/apm-collector-grpc-manager/collector-grpc-manager-define/pom.xml
#	apm-collector/apm-collector-grpc-manager/collector-grpc-manager-provider/pom.xml
#	apm-collector/apm-collector-grpc-manager/pom.xml
#	apm-collector/apm-collector-instrument/pom.xml
#	apm-collector/apm-collector-jetty-manager/collector-jetty-manager-define/pom.xml
#	apm-collector/apm-collector-jetty-manager/collector-jetty-manager-provider/pom.xml
#	apm-collector/apm-collector-jetty-manager/pom.xml
#	apm-collector/apm-collector-naming/collector-naming-define/pom.xml
#	apm-collector/apm-collector-naming/collector-naming-jetty-provider/pom.xml
#	apm-collector/apm-collector-naming/pom.xml
#	apm-collector/apm-collector-remote/collector-remote-define/pom.xml
#	apm-collector/apm-collector-remote/collector-remote-grpc-provider/pom.xml
#	apm-collector/apm-collector-remote/collector-remote-kafka-provider/pom.xml
#	apm-collector/apm-collector-remote/pom.xml
#	apm-collector/apm-collector-storage/collector-storage-define/pom.xml
#	apm-collector/apm-collector-storage/collector-storage-es-provider/pom.xml
#	apm-collector/apm-collector-storage/collector-storage-h2-provider/pom.xml
#	apm-collector/apm-collector-storage/collector-storage-shardingjdbc-provider/pom.xml
#	apm-collector/apm-collector-storage/pom.xml
#	apm-collector/apm-collector-thirdparty-receiver/pom.xml
#	apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/pom.xml
#	apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/receiver-zipkin-define/pom.xml
#	apm-collector/apm-collector-thirdparty-receiver/receiver-zipkin/receiver-zipkin-provider/pom.xml
#	apm-collector/apm-collector-ui/collector-ui-define/pom.xml
#	apm-collector/apm-collector-ui/collector-ui-graphql/pom.xml
#	apm-collector/apm-collector-ui/collector-ui-jetty-provider/pom.xml
#	apm-collector/apm-collector-ui/pom.xml
#	apm-collector/pom.xml
#	apm-commons/apm-datacarrier/pom.xml
#	apm-commons/apm-util/pom.xml
#	apm-commons/pom.xml
#	apm-dist/pom.xml
#	apm-protocol/apm-network/pom.xml
#	apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
#	apm-protocol/apm-ui-protocol/pom.xml
#	apm-protocol/pom.xml
#	apm-sniffer/apm-agent-core/pom.xml
#	apm-sniffer/apm-agent/pom.xml
#	apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/dubbo-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/elastic-job-2.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/feign-default-http-9.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/httpClient-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/jdbc-commons/pom.xml
#	apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/mongodb-2.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/mongodb-3.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/motan-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/nutz-plugins/http-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/nutz-plugins/mvc-annotation-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/nutz-plugins/pom.xml
#	apm-sniffer/apm-sdk-plugin/okhttp-3.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/rocketMQ-3.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/servicecomb-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-0.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/sofarpc-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/core-patch/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/netflix-plugins/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/netflix-plugins/spring-cloud-feign-1.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/pom.xml
#	apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/struts2-2.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/pom.xml
#	apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/pom.xml
#	apm-sniffer/apm-test-tools/pom.xml
#	apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-1.x-activation/pom.xml
#	apm-sniffer/apm-toolkit-activation/apm-toolkit-log4j-2.x-activation/pom.xml
#	apm-sniffer/apm-toolkit-activation/apm-toolkit-logback-1.x-activation/pom.xml
#	apm-sniffer/apm-toolkit-activation/apm-toolkit-opentracing-activation/pom.xml
#	apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/pom.xml
#	apm-sniffer/apm-toolkit-activation/pom.xml
#	apm-sniffer/optional-plugins/optional-spring-plugins/pom.xml
#	apm-sniffer/optional-plugins/optional-spring-plugins/spring-annotation-plugin/pom.xml
#	apm-sniffer/optional-plugins/pom.xml
#	apm-sniffer/optional-plugins/trace-ignore-plugin/pom.xml
#	apm-sniffer/pom.xml
#	apm-webapp/pom.xml
#	docs/README.md
#	docs/README_ZH.md
#	docs/cn/Direct-uplink-CN.md
#	docs/cn/How-to-build-CN.md
#	docs/cn/Optional-plugins-CN.md
#	docs/users.md
#	pom.xml
......@@ -68,7 +68,7 @@ public class InstanceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker<
Instance instance = instanceDAO.getInstance(alarm.getBehindInstanceId());
JsonObject osInfo = gson.fromJson(instance.getOsInfo(), JsonObject.class);
String serverName = Const.UNKNOWN;
if (osInfo.has("hostName")) {
if (osInfo != null && osInfo.has("hostName")) {
serverName = osInfo.get("hostName").getAsString();
}
......
# Zipkin接收器
[Zipkin](http://zipkin.io/)接收器提供了接受Zipkin格式的span数据功能。SkyWalking可以分析、聚合并且将数据展示到可视化界面。因此,用户不需要了解SkyWalking的自动采集探针(Java, .NET, node.js)是如何工作的,或者这些用户因为某些原因不想改变已有的采集方式,例如在Zipkin的集成工作已经完成的情况下。
Zipkin接受器在SkyWalking中仅仅只是一个可选特性,即使到目前为止它依然是[孵化特性](../../../../docs/cn/Incubating/Abstract-CN.md)
## 局限性
作为孵化功能,它仍是一个原型。所以它包含以下几点局限:
1. 不要在同一分布式系统中使用SkyWalking原生探针和Zipkin的类库。考虑到Zipkin和SkyWalking的HEADER不是共享/可互操作的,它们两者之间不会相互传播context。这会导致已跟踪的链路中断。
2. 不支持集群模式。
3. 在进行链路分析时,由于链路会在指定时间内结束。默认链路执行时间不超过2分钟。SkyWalking使用了更复杂的header和context结构,来避免zipkin分析时的这个问题。
## 开启Zipkin接收器
Zipkin接收器是一个可选模块,默认是关闭的。在collector的application.yml配置文件中修改下面的配置项来开启此功能:
```yaml
receiver_zipkin:
default:
host: localhost
port: 9411
contextPath: /
expireTime: 20 # 单位为秒
maxCacheSize: 1000000 # traces buffer的大小
```
......@@ -141,5 +141,10 @@ public class Config {
*/
public static boolean TRACE_PARAM = false;
}
public static class Elasticsearch {
public static boolean TRACE_DSL = false;
}
}
}
<?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>5.0.0-RC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apm-elasticsearch-5.x-plugin</artifactId>
<packaging>jar</packaging>
<name>elasticsearch-5.x-plugin</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<elasticsearch-client-transport.version>5.6.6</elasticsearch-client-transport.version>
</properties>
<dependencies>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>${elasticsearch-client-transport.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.plugin.elasticsearch.v5;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.elasticsearch.client.transport.TransportClient;
import static org.apache.skywalking.apm.plugin.elasticsearch.v5.Constants.ES_ENHANCE_INFO;
/**
* @author oatiz.
*/
public class ActionRequestBuilderInterceptor implements InstanceConstructorInterceptor {
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
ElasticSearchEnhanceInfo enhanceInfo = new ElasticSearchEnhanceInfo();
parseClientInfo(allArguments[0], enhanceInfo);
ContextManager.getRuntimeContext().put(ES_ENHANCE_INFO, enhanceInfo);
}
private void parseClientInfo(Object client, ElasticSearchEnhanceInfo enhanceInfo) {
if (client instanceof TransportClient) {
TransportClient transportClient = (TransportClient) client;
StringBuilder builder = new StringBuilder();
for (int i = 0; i < transportClient.transportAddresses().size(); i++) {
if (i != transportClient.transportAddresses().size() - 1) {
builder.append(transportClient.transportAddresses().get(i).toString()).append(",");
} else {
builder.append(transportClient.transportAddresses().get(i).toString());
}
}
enhanceInfo.setTransportAddress(builder.toString());
} else {
// avoid NPE
enhanceInfo.setTransportAddress("");
}
}
}
/*
* 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.v5;
/**
* @author oatiz.
*/
class Constants {
static final String DB_TYPE = "Elasticsearch";
static final String ELASTICSEARCH_DB_OP_PREFIX = "Elasticsearch/";
static final String ES_ENHANCE_INFO = "es_enhance_info";
static final String BASE_FUTURE_METHOD = "actionGet";
static final String ES_NODE = "node.address";
static final String ES_INDEX = "es.indices";
static final String ES_TYPE = "es.types";
static final String ES_TOOK_MILLIS = "es.took_millis";
static final String ES_TOTAL_HITS = "es.total_hits";
static final String ES_INGEST_TOOK_MILLIS = "es.ingest_took_millis";
}
/*
* 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.v5;
/**
* @author oatiz.
*/
public class ElasticSearchEnhanceInfo {
/**
* elasticsearch host and port
*/
private String transportAddress;
/**
* elasticsearch cluster name
*/
private String clusterName;
/**
* elasticsearch indices
*/
private String indices;
/**
* elasticsearch types
*/
private String types;
/**
* operation type: INDEX, CREATE, UPDATE, DELETE, BULK-bulkNum, defaultActionName
*/
private String opType;
/**
* source dsl
*/
private String source;
public String getTransportAddress() {
return transportAddress;
}
public void setTransportAddress(String transportAddress) {
this.transportAddress = transportAddress;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getIndices() {
return indices;
}
public void setIndices(String indices) {
this.indices = indices;
}
public String getTypes() {
return types;
}
public void setTypes(String types) {
this.types = types;
}
public String getOpType() {
return opType;
}
public void setOpType(String opType) {
this.opType = opType;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}
/*
* 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.v5;
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.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.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.search.SearchResponse;
import java.lang.reflect.Method;
import static org.apache.skywalking.apm.plugin.elasticsearch.v5.Constants.*;
/**
* @author oatiz.
*/
public class PlainListenableActionFutureInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
AbstractSpan span = ContextManager.createLocalSpan(ELASTICSEARCH_DB_OP_PREFIX + BASE_FUTURE_METHOD);
span.setComponent(ComponentsDefine.TRANSPORT_CLIENT);
Tags.DB_TYPE.set(span, DB_TYPE);
}
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Object ret) throws Throwable {
AbstractSpan span = ContextManager.activeSpan();
if (ret instanceof SearchResponse) {
SearchResponse response = (SearchResponse) ret;
span.tag(ES_TOOK_MILLIS, Long.toString(response.getTookInMillis()));
span.tag(ES_TOTAL_HITS, Long.toString(response.getHits().getTotalHits()));
} else if (ret instanceof BulkResponse) {
BulkResponse response = (BulkResponse) ret;
span.tag(ES_TOOK_MILLIS, Long.toString(response.getTookInMillis()));
span.tag(ES_INGEST_TOOK_MILLIS, Long.toString(response.getIngestTookInMillis()));
}
ContextManager.stopSpan();
return ret;
}
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
}
}
/*
* 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.v5;
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.elasticsearch.cluster.node.DiscoveryNode;
import java.lang.reflect.Method;
import static org.apache.skywalking.apm.agent.core.conf.Config.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v5.Constants.*;
import static org.apache.skywalking.apm.plugin.elasticsearch.v5.Util.wrapperNullStringValue;
/**
* @author oatiz.
*/
public class TransportActionNodeProxyInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
ElasticSearchEnhanceInfo enhanceInfo = (ElasticSearchEnhanceInfo) ContextManager.getRuntimeContext().get(ES_ENHANCE_INFO);
String opType = allArguments[1].getClass().getSimpleName();
String operationName = ELASTICSEARCH_DB_OP_PREFIX + opType;
AbstractSpan span = ContextManager.createExitSpan(operationName, enhanceInfo.getTransportAddress());
span.setComponent(ComponentsDefine.TRANSPORT_CLIENT);
Tags.DB_TYPE.set(span, DB_TYPE);
Tags.DB_INSTANCE.set(span, enhanceInfo.getClusterName());
if (TRACE_DSL) {
Tags.DB_STATEMENT.set(span, enhanceInfo.getSource());
}
span.tag(ES_NODE, ((DiscoveryNode) allArguments[0]).getAddress().toString());
span.tag(ES_INDEX, wrapperNullStringValue(enhanceInfo.getIndices()));
span.tag(ES_TYPE, wrapperNullStringValue(enhanceInfo.getTypes()));
SpanLayer.asDB(span);
ContextManager.getRuntimeContext().remove(ES_ENHANCE_INFO);
}
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Object ret) throws Throwable {
ContextManager.stopSpan();
return ret;
}
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
}
}
/*
* 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.v5;
import org.apache.skywalking.apm.agent.core.context.ContextManager;
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.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.apache.skywalking.apm.util.StringUtil;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentFactory;
import java.io.IOException;
import java.lang.reflect.Method;
import static org.apache.skywalking.apm.agent.core.conf.Config.Plugin.Elasticsearch.TRACE_DSL;
import static org.apache.skywalking.apm.plugin.elasticsearch.v5.Constants.ES_ENHANCE_INFO;
import static org.apache.skywalking.apm.plugin.elasticsearch.v5.Util.wrapperNullStringValue;
/**
* @author oatiz.
*/
public class TransportProxyClientInterceptor implements InstanceConstructorInterceptor, InstanceMethodsAroundInterceptor {
private static final ILog logger = LogManager.getLogger(TransportProxyClientInterceptor.class);
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
Settings settings = (Settings) allArguments[0];
String clusterName = settings.get("cluster.name");
objInst.setSkyWalkingDynamicField(wrapperNullStringValue(clusterName));
}
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
ElasticSearchEnhanceInfo enhanceInfo = (ElasticSearchEnhanceInfo) ContextManager.getRuntimeContext().get(ES_ENHANCE_INFO);
enhanceInfo.setClusterName((String) objInst.getSkyWalkingDynamicField());
parseRequestInfo(allArguments[1], enhanceInfo);
}
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Object ret) throws Throwable {
return ret;
}
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
}
private void parseRequestInfo(Object request, ElasticSearchEnhanceInfo enhanceInfo) {
// search request
if (request instanceof SearchRequest) {
parseSearchRequest(request, enhanceInfo);
return;
}
// get request
if (request instanceof GetRequest) {
parseGetRequest(request, enhanceInfo);
return;
}
// index request
if (request instanceof IndexRequest) {
parseIndexRequest(request, enhanceInfo);
return;
}
// update request
if (request instanceof UpdateRequest) {
parseUpdateRequest(request, enhanceInfo);
return;
}
// delete request
if (request instanceof DeleteRequest) {
parseDeleteRequest(request, enhanceInfo);
}
}
private void parseSearchRequest(Object request, ElasticSearchEnhanceInfo enhanceInfo) {
SearchRequest searchRequest = (SearchRequest) request;
enhanceInfo.setIndices(StringUtil.join(',', searchRequest.indices()));
enhanceInfo.setTypes(StringUtil.join(',', searchRequest.types()));
if (TRACE_DSL) {
enhanceInfo.setSource(null == searchRequest.source() ? "" : searchRequest.source().toString());
}
}
private void parseGetRequest(Object request, ElasticSearchEnhanceInfo enhanceInfo) {
GetRequest getRequest = (GetRequest) request;
enhanceInfo.setIndices(StringUtil.join(',', getRequest.indices()));
enhanceInfo.setTypes(getRequest.type());
if (TRACE_DSL) {
enhanceInfo.setSource(getRequest.toString());
}
}
private void parseIndexRequest(Object request, ElasticSearchEnhanceInfo enhanceInfo) {
IndexRequest indexRequest = (IndexRequest) request;
enhanceInfo.setIndices(StringUtil.join(',', indexRequest.indices()));
enhanceInfo.setTypes(indexRequest.type());
if (TRACE_DSL) {
enhanceInfo.setSource(indexRequest.toString());
}
}
private void parseUpdateRequest(Object request, ElasticSearchEnhanceInfo enhanceInfo) {
UpdateRequest updateRequest = (UpdateRequest) request;
enhanceInfo.setIndices(StringUtil.join(',', updateRequest.indices()));
enhanceInfo.setTypes(updateRequest.type());
if (TRACE_DSL) {
String updateDsl = "";
try {
updateDsl = updateRequest.toXContent(XContentFactory.jsonBuilder(), null).string();
} catch (IOException e) {
logger.warn("trace update request dsl error: ", e);
}
enhanceInfo.setSource(updateDsl);
}
}
private void parseDeleteRequest(Object request, ElasticSearchEnhanceInfo enhanceInfo) {
DeleteRequest deleteRequest = (DeleteRequest) request;
enhanceInfo.setIndices(StringUtil.join(',', deleteRequest.indices()));
enhanceInfo.setTypes(deleteRequest.type());
if (TRACE_DSL) {
enhanceInfo.setSource(deleteRequest.toString());
}
}
}
/*
* 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.v5;
import static org.apache.skywalking.apm.util.StringUtil.isEmpty;
/**
* @author oatiz.
*/
class Util {
static String wrapperNullStringValue(String value) {
if (isEmpty(value)) {
return "";
}
return value;
}
}
/*
* 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.v5.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.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.any;
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* @author oatiz.
*/
public class ActionRequestBuilderInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "org.apache.skywalking.apm.plugin.elasticsearch.v5.ActionRequestBuilderInterceptor";
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return new ConstructorInterceptPoint[]{
new ConstructorInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getConstructorMatcher() {
return any();
}
@Override
public String getConstructorInterceptor() {
return ENHANCE_CLASS;
}
}
};
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[0];
}
@Override
protected ClassMatch enhanceClass() {
return byName("org.elasticsearch.action.ActionRequestBuilder");
}
}
/*
* 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.v5.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 static net.bytebuddy.matcher.ElementMatchers.named;
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* @author oatiz.
*/
public class PlainListenableActionFutureInstrumentation extends ClassEnhancePluginDefine {
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return new ConstructorInterceptPoint[0];
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[]{
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("actionGet");
}
@Override
public String getMethodsInterceptor() {
return "org.apache.skywalking.apm.plugin.elasticsearch.v5.PlainListenableActionFutureInterceptor";
}
@Override
public boolean isOverrideArgs() {
return false;
}
}
};
}
@Override
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
return new StaticMethodsInterceptPoint[0];
}
@Override
protected ClassMatch enhanceClass() {
return byName("org.elasticsearch.action.support.PlainListenableActionFuture");
}
}
/*
* 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.v5.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 static net.bytebuddy.matcher.ElementMatchers.named;
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* @author oatiz.
*/
public class TransportActionNodeProxyInstrumentation extends ClassEnhancePluginDefine {
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return new ConstructorInterceptPoint[0];
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[]{
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("execute");
}
@Override
public String getMethodsInterceptor() {
return "org.apache.skywalking.apm.plugin.elasticsearch.v5.TransportActionNodeProxyInterceptor";
}
@Override
public boolean isOverrideArgs() {
return false;
}
}
};
}
@Override
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
return new StaticMethodsInterceptPoint[0];
}
@Override
protected ClassMatch enhanceClass() {
return byName("org.elasticsearch.action.TransportActionNodeProxy");
}
}
/*
* 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.v5.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 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;
/**
* @author oatiz.
*/
public class TransportProxyClientInstrumentation extends ClassEnhancePluginDefine {
private static final String ENHANCE_CLASS = "org.apache.skywalking.apm.plugin.elasticsearch.v5.TransportProxyClientInterceptor";
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return new ConstructorInterceptPoint[]{
new ConstructorInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getConstructorMatcher() {
return any();
}
@Override
public String getConstructorInterceptor() {
return ENHANCE_CLASS;
}
}
};
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[]{
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named("execute");
}
@Override
public String getMethodsInterceptor() {
return ENHANCE_CLASS;
}
@Override
public boolean isOverrideArgs() {
return false;
}
}
};
}
@Override
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
return new StaticMethodsInterceptPoint[0];
}
@Override
protected ClassMatch enhanceClass() {
return byName("org.elasticsearch.client.transport.TransportProxyClient");
}
}
# 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.
elasticsearch-5.x=org.apache.skywalking.apm.plugin.elasticsearch.v5.define.ActionRequestBuilderInstrumentation
elasticsearch-5.x=org.apache.skywalking.apm.plugin.elasticsearch.v5.define.TransportProxyClientInstrumentation
elasticsearch-5.x=org.apache.skywalking.apm.plugin.elasticsearch.v5.define.TransportActionNodeProxyInstrumentation
elasticsearch-5.x=org.apache.skywalking.apm.plugin.elasticsearch.v5.define.PlainListenableActionFutureInstrumentation
......@@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor;
import java.lang.reflect.Method;
......
......@@ -3,12 +3,11 @@
## 介绍
- 这个插件的作用是对追踪的个性化服务过滤.
- 你可以设置多个需要忽略的路径, 意味着包含这些路径的`追踪信息`不会被`agent`发送到 `collector`.
- 你可以设置多个需要忽略的URL路径, 意味着包含这些路径的`追踪信息`不会被`agent`发送到 `collector`.
- 当前的路径匹配规则是 `Ant Path`匹配风格 , 例如 `/path/*`, `/path/**`, `/path/?`.
-`apm-trace-ignore-plugin-x.jar`拷贝到`agent/plugins`后,重启探针即可生效
- [Skywalking-使用可选插件 apm-trace-ignore-plugin](https://blog.csdn.net/u013095337/article/details/80452088) 有详细使用介绍
## 如何配置路径
有两种配置方式,可使用任意一种,配置生效的优先级从高到低
1. 在系统环境变量中配置,你需要在系统变量中添加`skywalking.trace.ignore_path`, 值是你需要忽略的路径,多个以`,`号分隔
......
......@@ -41,6 +41,8 @@
* Memcached Client
* [Spymemcached](https://github.com/couchbase/spymemcached) 2.x
* [Xmemcached](https://github.com/killme2008/xmemcached) 2.x
* [Elasticsearch](https://github.com/elastic/elasticsearch)
* [transport-client](https://github.com/elastic/elasticsearch/tree/master/client/transport) 5.2.x-5.6.x
* Service Discovery
* [Netflix Eureka](https://github.com/Netflix/eureka)
* Spring Ecosystem
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册