diff --git a/apm-commons/apm-logging-api/pom.xml b/apm-commons/apm-logging-api/pom.xml
deleted file mode 100644
index 2bcc56363..000000000
--- a/apm-commons/apm-logging-api/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- apm-commons
- org.skywalking
- 3.2.3-2017
-
- 4.0.0
-
- apm-logging-api
-
diff --git a/apm-commons/apm-logging-api/src/test/java/org/skywalking/apm/logging/LogManagerTest.java b/apm-commons/apm-logging-api/src/test/java/org/skywalking/apm/logging/LogManagerTest.java
deleted file mode 100644
index c0c6a54d4..000000000
--- a/apm-commons/apm-logging-api/src/test/java/org/skywalking/apm/logging/LogManagerTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2017, OpenSkywalking Organization All rights reserved.
- *
- * Licensed 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 repository: https://github.com/OpenSkywalking/skywalking
- */
-
-package org.skywalking.apm.logging;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.powermock.api.support.membermodification.MemberModifier;
-
-/**
- * @author wusheng
- */
-public class LogManagerTest {
-
- @Test
- public void testGetNoopLogger() {
- ILog logger = LogManager.getLogger(LogManagerTest.class);
- Assert.assertEquals(NoopLogger.INSTANCE, logger);
- }
-
- @Before
- @After
- public void clear() throws IllegalAccessException {
- MemberModifier.field(LogManager.class, "RESOLVER").set(null, null);
- }
-
- public class TestLogger implements ILog {
-
- @Override
- public void info(String format) {
-
- }
-
- @Override
- public void info(String format, Object... arguments) {
-
- }
-
- @Override
- public void warn(String format, Object... arguments) {
-
- }
-
- @Override
- public void error(String format, Throwable e) {
-
- }
-
- @Override
- public void error(Throwable e, String format, Object... arguments) {
-
- }
-
- @Override
- public boolean isDebugEnable() {
- return false;
- }
-
- @Override
- public boolean isInfoEnable() {
- return false;
- }
-
- @Override
- public boolean isWarnEnable() {
- return false;
- }
-
- @Override
- public boolean isErrorEnable() {
- return false;
- }
-
- @Override
- public void debug(String format) {
-
- }
-
- @Override
- public void debug(String format, Object... arguments) {
-
- }
-
- @Override
- public void error(String format) {
-
- }
- }
-
-}
diff --git a/apm-commons/apm-logging-api/src/test/java/org/skywalking/apm/logging/NoopLoggerTest.java b/apm-commons/apm-logging-api/src/test/java/org/skywalking/apm/logging/NoopLoggerTest.java
deleted file mode 100644
index 1ab13e64b..000000000
--- a/apm-commons/apm-logging-api/src/test/java/org/skywalking/apm/logging/NoopLoggerTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2017, OpenSkywalking Organization All rights reserved.
- *
- * Licensed 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 repository: https://github.com/OpenSkywalking/skywalking
- */
-
-package org.skywalking.apm.logging;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Created by wusheng on 2017/2/27.
- */
-public class NoopLoggerTest {
- @Test
- public void testOnNothing() {
- Assert.assertFalse(NoopLogger.INSTANCE.isDebugEnable());
- Assert.assertFalse(NoopLogger.INSTANCE.isInfoEnable());
- Assert.assertFalse(NoopLogger.INSTANCE.isErrorEnable());
- Assert.assertFalse(NoopLogger.INSTANCE.isWarnEnable());
-
- NoopLogger.INSTANCE.debug("Any string");
- NoopLogger.INSTANCE.debug("Any string", new Object[0]);
- NoopLogger.INSTANCE.info("Any string");
- NoopLogger.INSTANCE.info("Any string", new Object[0]);
- NoopLogger.INSTANCE.warn("Any string", new Object[0]);
- NoopLogger.INSTANCE.warn("Any string", new Object[0], new NullPointerException());
- NoopLogger.INSTANCE.error("Any string");
- NoopLogger.INSTANCE.error("Any string", new NullPointerException());
- }
-}
diff --git a/apm-commons/pom.xml b/apm-commons/pom.xml
index c1b4736cf..f9ab71c09 100644
--- a/apm-commons/pom.xml
+++ b/apm-commons/pom.xml
@@ -30,7 +30,6 @@
apm-util
- apm-logging-apiapm-datacarrier
diff --git a/apm-sniffer/apm-agent-core/pom.xml b/apm-sniffer/apm-agent-core/pom.xml
index 5b995f1e9..7f821a7ef 100644
--- a/apm-sniffer/apm-agent-core/pom.xml
+++ b/apm-sniffer/apm-agent-core/pom.xml
@@ -55,12 +55,12 @@
org.skywalking
- apm-logging-api
+ apm-network${project.version}org.skywalking
- apm-network
+ apm-util${project.version}
@@ -194,6 +194,23 @@
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ prepare-package
+
+ run
+
+
+
+
+
+
+
+
+
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/AgentPackageNotFoundException.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/AgentPackageNotFoundException.java
new file mode 100644
index 000000000..b356c3ca9
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/AgentPackageNotFoundException.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017, OpenSkywalking Organization All rights reserved.
+ *
+ * Licensed 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 repository: https://github.com/OpenSkywalking/skywalking
+ */
+
+package org.skywalking.apm.agent.core.boot;
+
+/**
+ * @author wusheng
+ */
+public class AgentPackageNotFoundException extends Exception {
+ public AgentPackageNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/AgentPackagePath.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/AgentPackagePath.java
new file mode 100644
index 000000000..254cce7f0
--- /dev/null
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/AgentPackagePath.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2017, OpenSkywalking Organization All rights reserved.
+ *
+ * Licensed 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 repository: https://github.com/OpenSkywalking/skywalking
+ */
+
+package org.skywalking.apm.agent.core.boot;
+
+import org.skywalking.apm.agent.core.logging.api.ILog;
+import org.skywalking.apm.agent.core.logging.api.LogManager;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @author wusheng
+ */
+public class AgentPackagePath {
+ private static final ILog logger = LogManager.getLogger(AgentPackagePath.class);
+
+ private static File AGENT_PACKAGE_PATH;
+
+ public static File getPath() throws AgentPackageNotFoundException {
+ if (AGENT_PACKAGE_PATH == null) {
+ AGENT_PACKAGE_PATH = findPath();
+ }
+ return AGENT_PACKAGE_PATH;
+ }
+
+ public static boolean isPathFound() {
+ return AGENT_PACKAGE_PATH != null;
+ }
+
+ private static File findPath() throws AgentPackageNotFoundException {
+ String classResourcePath = AgentPackagePath.class.getName().replaceAll("\\.", "/") + ".class";
+
+ URL resource = AgentPackagePath.class.getClassLoader().getSystemClassLoader().getResource(classResourcePath);
+ if (resource != null) {
+ String urlString = resource.toString();
+
+ logger.debug("The beacon class location is {}.", urlString);
+
+ int insidePathIndex = urlString.indexOf('!');
+ boolean isInJar = insidePathIndex > -1;
+
+ if (isInJar) {
+ urlString = urlString.substring(urlString.indexOf("file:"), insidePathIndex);
+ File agentJarFile = null;
+ try {
+ agentJarFile = new File(new URL(urlString).getFile());
+ } catch (MalformedURLException e) {
+ logger.error(e, "Can not locate agent jar file by url:" + urlString);
+ }
+ if (agentJarFile.exists()) {
+ return agentJarFile.getParentFile();
+ }
+ } else {
+ String classLocation = urlString.substring(urlString.indexOf("file:"), urlString.length() - classResourcePath.length());
+ return new File(classLocation);
+ }
+ }
+
+ logger.error("Can not locate agent jar file.");
+ throw new AgentPackageNotFoundException("Can not locate agent jar file.");
+ }
+
+}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/ServiceManager.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/ServiceManager.java
index bbf82dd92..267d14ae1 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/ServiceManager.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/ServiceManager.java
@@ -22,8 +22,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader;
-import org.skywalking.apm.logging.ILog;
-import org.skywalking.apm.logging.LogManager;
+import org.skywalking.apm.agent.core.logging.api.ILog;
+import org.skywalking.apm.agent.core.logging.api.LogManager;
/**
* The ServiceManager bases on {@link ServiceLoader},
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java
index 07f0f26d8..55e58942f 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/Config.java
@@ -18,11 +18,9 @@
package org.skywalking.apm.agent.core.conf;
-import java.util.LinkedList;
-import java.util.List;
import org.skywalking.apm.agent.core.context.trace.TraceSegment;
-import org.skywalking.apm.agent.core.logging.LogLevel;
-import org.skywalking.apm.agent.core.logging.WriterFactory;
+import org.skywalking.apm.agent.core.logging.core.LogLevel;
+import org.skywalking.apm.agent.core.logging.core.WriterFactory;
/**
* This is the core config in sniffer agent.
@@ -129,22 +127,6 @@ public class Config {
}
public static class Plugin {
-
- /**
- * Name of disabled plugin, The value spilt by ,
- * if you have multiple plugins need to disable.
- *
- * Here are the plugin names :
- * tomcat-7.x/8.x, dubbo, jedis-2.x, motan, httpclient-4.x, jdbc, mongodb-3.x.
- */
- public static List DISABLED_PLUGINS = new LinkedList();
-
- /**
- * Name of force enable plugin, The value spilt by ,
- * if you have multiple plugins need to enable.
- */
- public static List FORCE_ENABLE_PLUGINS = new LinkedList();
-
public static class MongoDB {
/**
* If true, trace all the parameters, default is false.
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/logging/WriterFactory.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/ConfigNotFoundException.java
similarity index 65%
rename from apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/logging/WriterFactory.java
rename to apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/ConfigNotFoundException.java
index 46af9f9fc..6c8dffac0 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/logging/WriterFactory.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/ConfigNotFoundException.java
@@ -16,17 +16,17 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
-package org.skywalking.apm.agent.core.logging;
+package org.skywalking.apm.agent.core.conf;
-import org.skywalking.apm.agent.core.conf.Config;
-import org.skywalking.apm.util.StringUtil;
+/**
+ * @author wusheng
+ */
+public class ConfigNotFoundException extends Exception {
+ public ConfigNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
-public class WriterFactory {
- public static IWriter getLogWriter() {
- if (!StringUtil.isEmpty(Config.Logging.DIR)) {
- return FileWriter.get();
- } else {
- return SystemOutWriter.INSTANCE;
- }
+ public ConfigNotFoundException(String message) {
+ super(message);
}
}
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
index 1d62349f7..5c8908220 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java
@@ -18,17 +18,20 @@
package org.skywalking.apm.agent.core.conf;
+import org.skywalking.apm.agent.core.boot.AgentPackageNotFoundException;
+import org.skywalking.apm.agent.core.boot.AgentPackagePath;
+import org.skywalking.apm.agent.core.logging.api.ILog;
+import org.skywalking.apm.agent.core.logging.api.LogManager;
+import org.skywalking.apm.util.ConfigInitializer;
+import org.skywalking.apm.util.StringUtil;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
-import org.skywalking.apm.logging.ILog;
-import org.skywalking.apm.logging.LogManager;
-import org.skywalking.apm.util.ConfigInitializer;
-import org.skywalking.apm.util.StringUtil;
/**
* The SnifferConfigInitializer initializes all configs in several way.
@@ -38,92 +41,76 @@ import org.skywalking.apm.util.StringUtil;
*/
public class SnifferConfigInitializer {
private static final ILog logger = LogManager.getLogger(SnifferConfigInitializer.class);
- private static String CONFIG_FILE_NAME = "/sky-walking.config";
+ private static String CONFIG_FILE_NAME = "/config/agent.config";
+ private static String ENV_KEY_PREFIX = "skywalking.";
/**
- * Try to locate config file, named {@link #CONFIG_FILE_NAME}, in following order:
- * 1. Path from SystemProperty. {@link #loadConfigBySystemProperty()}
- * 2. class path.
- * 3. Path, where agent is. {@link #loadConfigFromAgentFolder()}
+ * Try to locate `agent.config`, which should be in the /config dictionary of agent package.
*
- * If no found in any path, agent is still going to run in default config, {@link Config},
- * but in initialization steps, these following configs must be set, by config file or system properties:
+ * Also try to override the config by system.env and system.properties. All the keys in these two places should
+ * start with {@link #ENV_KEY_PREFIX}. e.g. in env `skywalking.agent.application_code=yourAppName` to override
+ * `agent.application_code` in config file.
*
- * 1. applicationCode. "-DapplicationCode=" or {@link Config.Agent#APPLICATION_CODE}
- * 2. servers. "-Dservers=" or {@link Config.Collector#SERVERS}
+ * At the end, `agent.application_code` and `collector.servers` must be not blank.
*/
- public static void initialize() {
+ public static void initialize() throws ConfigNotFoundException, AgentPackageNotFoundException {
InputStream configFileStream;
- configFileStream = loadConfigBySystemProperty();
-
- if (configFileStream == null) {
- configFileStream = SnifferConfigInitializer.class.getResourceAsStream(CONFIG_FILE_NAME);
-
- if (configFileStream == null) {
- logger.info("No config file found, according system property '-Dconfig'.");
- configFileStream = loadConfigFromAgentFolder();
- } else {
- logger.info("{} file found in class path.", CONFIG_FILE_NAME);
- }
+ try {
+ configFileStream = loadConfigFromAgentFolder();
+ Properties properties = new Properties();
+ properties.load(configFileStream);
+ ConfigInitializer.initialize(properties, Config.class);
+ } catch (Exception e) {
+ logger.error(e, "Failed to read the config file, skywalking is going to run in default config.");
}
- if (configFileStream == null) {
- logger.info("No {} found, sky-walking is going to run in default config.", CONFIG_FILE_NAME);
- } else {
- try {
- Properties properties = new Properties();
- properties.load(configFileStream);
- ConfigInitializer.initialize(properties, Config.class);
- } catch (Exception e) {
- logger.error("Failed to read the config file, sky-walking is going to run in default config.", e);
- }
- }
-
- String applicationCode = System.getProperty("applicationCode");
- if (!StringUtil.isEmpty(applicationCode)) {
- Config.Agent.APPLICATION_CODE = applicationCode;
- }
- String servers = System.getProperty("servers");
- if (!StringUtil.isEmpty(servers)) {
- Config.Collector.SERVERS = servers;
+ try {
+ overrideConfigBySystemEnv();
+ } catch (Exception e) {
+ logger.error(e, "Failed to read the system env.");
}
if (StringUtil.isEmpty(Config.Agent.APPLICATION_CODE)) {
- throw new ExceptionInInitializerError("'-DapplicationCode=' is missing.");
+ throw new ExceptionInInitializerError("`agent.application_code` is missing.");
}
if (StringUtil.isEmpty(Config.Collector.SERVERS)) {
- throw new ExceptionInInitializerError("'-Dservers=' is missing.");
+ throw new ExceptionInInitializerError("`collector.servers` is missing.");
}
}
/**
- * Load the config file by the path, which is provided by system property, usually with a "-Dconfig=" arg.
+ * Override the config by system env. The env key must start with `skywalking`, the reuslt should be as same as in
+ * `agent.config`
+ *
+ * such as:
+ * Env key of `agent.application_code` shoule be `skywalking.agent.application_code`
*
* @return the config file {@link InputStream}, or null if not needEnhance.
*/
- private static InputStream loadConfigBySystemProperty() {
- String config = System.getProperty("config");
- if (StringUtil.isEmpty(config)) {
- return null;
- }
- File configFile = new File(config);
- if (configFile.exists() && configFile.isDirectory()) {
- logger.info("check {} in path {}, according system property.", CONFIG_FILE_NAME, config);
- configFile = new File(config, CONFIG_FILE_NAME);
- }
-
- if (configFile.exists() && configFile.isFile()) {
- try {
- logger.info("found {}, according system property.", configFile.getAbsolutePath());
- return new FileInputStream(configFile);
- } catch (FileNotFoundException e) {
- logger.error(e, "Fail to load {} , according system property.", config);
+ private static void overrideConfigBySystemEnv() throws IllegalAccessException {
+ Properties properties = new Properties();
+ Properties systemProperties = System.getProperties();
+ Iterator> entryIterator = systemProperties.entrySet().iterator();
+ while (entryIterator.hasNext()) {
+ Map.Entry
+
+ org.skywalking
+ apm-util
+ ${project.version}
+ providedorg.skywalking
@@ -74,6 +84,44 @@
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.1
+
+
+ package
+
+ shade
+
+
+ false
+ true
+ true
+ true
+
+
+ com.lmax:*
+ org.apache.httpcomponents:*
+ commons-logging:*
+ commons-codec:*
+ *:gson
+ io.grpc:*
+ io.netty:*
+ com.google.*:*
+ com.google.guava:guava
+
+
+
+
+ ${shade.net.bytebuddy.source}
+ ${shade.net.bytebuddy.target}
+
+
+
+
+
+ org.apache.maven.pluginsmaven-resources-plugin
@@ -96,6 +144,51 @@
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ package
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ant-contrib
+ ant-contrib
+ 1.0b3
+
+
+ ant
+ ant
+
+
+
+
+ org.apache.ant
+ ant-nodeps
+ 1.8.1
+
+
+
diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java
index 4f6abb573..b278d2fc9 100644
--- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java
+++ b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java
@@ -35,8 +35,8 @@ import org.skywalking.apm.network.trace.component.ComponentsDefine;
import org.skywalking.apm.plugin.sjdbc.define.AsyncExecuteInterceptor;
/**
- * Sharding-jdbc provides {@link EventBusInstance} to help external systems get events of sql execution.
- * {@link ExecuteEventListener} can get sql statement start and end events, resulting in db span.
+ * Sharding-jdbc provides {@link EventBusInstance} to help external systems getDefault events of sql execution.
+ * {@link ExecuteEventListener} can getDefault sql statement start and end events, resulting in db span.
*
* @author gaohongtao
*/
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
index 4ba84d647..a27e12bae 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
@@ -36,13 +36,13 @@
org.springframeworkspring-core4.3.10.RELEASE
- provided
+ compileorg.springframeworkspring-webmvc4.3.8.RELEASE
- provided
+ compilejavax.servlet
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
index 38befd577..83be51dec 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
@@ -41,6 +41,7 @@
UTF-8
+ /..
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
index 51a325bb7..c904896c4 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
@@ -32,7 +32,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
- * {@link ResponseExtractorFutureInstrumentation} enhance the addCallback method and get
+ * {@link ResponseExtractorFutureInstrumentation} enhance the addCallback method and getDefault
* method of org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture by
* org.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor and
* org.skywalking.apm.plugin.spring.resttemplate.async.FutureGetInterceptor.
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/netflix-plugins/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/netflix-plugins/pom.xml
index 7ec3856c8..3ac357acf 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/netflix-plugins/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/netflix-plugins/pom.xml
@@ -38,6 +38,7 @@
UTF-8
+ /../../..
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/pom.xml b/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/pom.xml
index 1f471dd6b..612ea5335 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-cloud/pom.xml
@@ -38,6 +38,7 @@
UTF-8
+ /../..
diff --git a/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/skywalking/apm/plugin/spymemcached/v2/define/MemcachedInstrumentation.java b/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/skywalking/apm/plugin/spymemcached/v2/define/MemcachedInstrumentation.java
index ad70d7340..730745df2 100644
--- a/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/skywalking/apm/plugin/spymemcached/v2/define/MemcachedInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/skywalking/apm/plugin/spymemcached/v2/define/MemcachedInstrumentation.java
@@ -33,7 +33,7 @@ import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link MemcachedInstrumentation} presents that skywalking intercept all constructors and methods of
* {@link net.spy.memcached.MemcachedClient}.
- * {@link XMemcachedConstructorWithInetSocketAddressListArgInterceptor} intercepts the constructor with
+ * org.skywalking.apm.plugin.spymemcached.v2.MemcachedConstructorWithInetSocketAddressListArgInterceptor intercepts the constructor with
* argument {@link java.net.InetSocketAddress}.
*
* @author IluckySi
diff --git a/apm-sniffer/apm-test-tools/src/main/java/org/skywalking/apm/agent/test/tools/AgentServiceRule.java b/apm-sniffer/apm-test-tools/src/main/java/org/skywalking/apm/agent/test/tools/AgentServiceRule.java
index ebaad9f9d..ebcfddd77 100644
--- a/apm-sniffer/apm-test-tools/src/main/java/org/skywalking/apm/agent/test/tools/AgentServiceRule.java
+++ b/apm-sniffer/apm-test-tools/src/main/java/org/skywalking/apm/agent/test/tools/AgentServiceRule.java
@@ -23,10 +23,12 @@ import java.util.LinkedList;
import org.junit.rules.ExternalResource;
import org.skywalking.apm.agent.core.boot.BootService;
import org.skywalking.apm.agent.core.boot.ServiceManager;
+import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig;
import org.skywalking.apm.agent.core.context.IgnoredTracerContext;
import org.skywalking.apm.agent.core.context.TracingContext;
import org.skywalking.apm.agent.core.context.TracingContextListener;
+import org.skywalking.apm.agent.core.logging.core.LogLevel;
import org.skywalking.apm.agent.test.helper.FieldSetter;
public class AgentServiceRule extends ExternalResource {
@@ -38,6 +40,7 @@ public class AgentServiceRule extends ExternalResource {
FieldSetter.setValue(ServiceManager.INSTANCE.getClass(), "bootedServices", new HashMap());
FieldSetter.setValue(IgnoredTracerContext.ListenerManager.class, "LISTENERS", new LinkedList());
FieldSetter.setValue(TracingContext.ListenerManager.class, "LISTENERS", new LinkedList());
+ ServiceManager.INSTANCE.shutdown();
} catch (Exception e) {
}
}
@@ -45,6 +48,7 @@ public class AgentServiceRule extends ExternalResource {
@Override
protected void before() throws Throwable {
super.before();
+ Config.Logging.LEVEL = LogLevel.OFF;
ServiceManager.INSTANCE.boot();
RemoteDownstreamConfig.Agent.APPLICATION_ID = 1;
RemoteDownstreamConfig.Agent.APPLICATION_INSTANCE_ID = 1;
diff --git a/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextInterceptor.java b/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextInterceptor.java
index 849ecb288..f1c193411 100644
--- a/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextInterceptor.java
+++ b/apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/skywalking/apm/toolkit/activation/trace/TraceContextInterceptor.java
@@ -22,8 +22,8 @@ import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
-import org.skywalking.apm.logging.ILog;
-import org.skywalking.apm.logging.LogManager;
+import org.skywalking.apm.agent.core.logging.api.ILog;
+import org.skywalking.apm.agent.core.logging.api.LogManager;
public class TraceContextInterceptor implements StaticMethodsAroundInterceptor {
@@ -43,6 +43,6 @@ public class TraceContextInterceptor implements StaticMethodsAroundInterceptor {
@Override
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class>[] parameterTypes,
Throwable t) {
- logger.error("Failed to get trace Id.", t);
+ logger.error("Failed to getDefault trace Id.", t);
}
}
diff --git a/apm-sniffer/apm-toolkit-activation/pom.xml b/apm-sniffer/apm-toolkit-activation/pom.xml
index 4b73d3676..8cf9d3450 100644
--- a/apm-sniffer/apm-toolkit-activation/pom.xml
+++ b/apm-sniffer/apm-toolkit-activation/pom.xml
@@ -37,16 +37,118 @@
apm-toolkit-activation
+
+ UTF-8
+ net.bytebuddy
+ ${shade.package}.${shade.net.bytebuddy.source}
+
+
org.skywalkingapm-agent-core${project.version}
+ provided
+
+
+ org.skywalking
+ apm-util
+ ${project.version}
+ providedorg.skywalkingapm-test-tools${project.version}
+ provided
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.1
+
+
+ package
+
+ shade
+
+
+ false
+ true
+ true
+ true
+
+
+ com.lmax:*
+ org.apache.httpcomponents:*
+ commons-logging:*
+ commons-codec:*
+ *:gson
+ io.grpc:*
+ io.netty:*
+ com.google.*:*
+ com.google.guava:guava
+
+
+
+
+ ${shade.net.bytebuddy.source}
+ ${shade.net.bytebuddy.target}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ package
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ant-contrib
+ ant-contrib
+ 1.0b3
+
+
+ ant
+ ant
+
+
+
+
+ org.apache.ant
+ ant-nodeps
+ 1.8.1
+
+
+
+
+
diff --git a/apm-sniffer/config/agent.config b/apm-sniffer/config/agent.config
new file mode 100644
index 000000000..a81175845
--- /dev/null
+++ b/apm-sniffer/config/agent.config
@@ -0,0 +1,19 @@
+# The application name in UI
+agent.application_code=Your_ApplicationName
+
+# The number of sampled traces per 3 seconds
+# Negative number means sample traces as many as possible, most likely 100%
+# agent.sample_n_per_3_secs=-1
+
+# Ignore the segments if their operation names start with these suffix.
+# agent.ignore_suffix=.jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg
+
+# Server addresses.
+# Mapping to `agent_server/jetty/port` in `config/application.yml` of Collector.
+# Examples:
+# Single collector:SERVERS="127.0.0.1:8080"
+# Collector cluster:SERVERS="10.2.45.126:8080,10.2.45.127:7600"
+collector.servers=127.0.0.1:10800
+
+# Logging level
+logging.level=DEBUG
diff --git a/apm-sniffer/pom.xml b/apm-sniffer/pom.xml
index 06a420a22..4680003d6 100644
--- a/apm-sniffer/pom.xml
+++ b/apm-sniffer/pom.xml
@@ -40,13 +40,6 @@
1.6
+ org.skywalking.apm.dependencies
-
-
-
- org.skywalking
- apm-util
- 3.2.3-2017
-
-