提交 e6ea5e11 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Merge pull request #182 from wu-sheng/feature/181

Rename the "apm-api" module to "apm-agent-core”. 
......@@ -6,7 +6,7 @@ import com.typesafe.config.ConfigFactory;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.cluster.ClusterConfig;
import org.skywalking.apm.collector.cluster.Const;
......
package org.skywalking.apm.collector.cluster;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.config.ConfigProvider;
/**
......
......@@ -34,7 +34,7 @@ public enum ConfigInitializer {
for (ConfigProvider provider : configProviders) {
logger.info("configProvider provider name: %s", provider.getClass().getName());
Class configClass = provider.configClass();
org.skywalking.apm.api.util.ConfigInitializer.initialize(properties, configClass);
org.skywalking.apm.util.ConfigInitializer.initialize(properties, configClass);
}
}
}
package org.skywalking.apm.collector.worker.config;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.config.ConfigProvider;
/**
......
package org.skywalking.apm.collector.worker.config;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.config.ConfigProvider;
/**
......
......@@ -4,7 +4,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.actor.*;
import org.skywalking.apm.collector.actor.selector.RollingSelector;
import org.skywalking.apm.collector.actor.selector.WorkerSelector;
......
......@@ -2,7 +2,7 @@ package org.skywalking.apm.collector.worker.segment;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.actor.ClusterWorkerContext;
import org.skywalking.apm.collector.actor.LocalWorkerContext;
import org.skywalking.apm.collector.actor.ProviderNotFoundException;
......
package org.skywalking.apm.collector.worker.tools;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.collector.worker.Const;
import org.skywalking.apm.collector.worker.segment.entity.Span;
import org.skywalking.apm.collector.worker.segment.entity.tag.Tags;
......
package org.skywalking.apm.trace;
import org.skywalking.apm.api.util.MachineInfo;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.MachineInfo;
import org.skywalking.apm.util.StringUtil;
import java.util.UUID;
......
package org.skywalking.apm.api.util;
package org.skywalking.apm.util;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
......
package org.skywalking.apm.api.util;
package org.skywalking.apm.util;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
......
package org.skywalking.apm.api.util;
package org.skywalking.apm.util;
public final class StringUtil {
public static boolean isEmpty(String str) {
......
......@@ -8,10 +8,10 @@
<version>3.1-2017</version>
</parent>
<artifactId>apm-api</artifactId>
<artifactId>apm-agent-core</artifactId>
<packaging>jar</packaging>
<name>apm-api</name>
<name>apm-agent-core</name>
<url>http://maven.apache.org</url>
<properties>
......
package org.skywalking.apm.api.boot;
package org.skywalking.apm.agent.core.boot;
/**
* The <code>BootService</code> is an interface to all services, which need to boot when plugin mechanism begins to
......
package org.skywalking.apm.api.boot;
package org.skywalking.apm.agent.core.boot;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.boot;
package org.skywalking.apm.agent.core.boot;
/**
* The <code>StatusBootService</code> is an abstract implementations of {@link BootService}, it extends {@link
......
package org.skywalking.apm.api.client;
package org.skywalking.apm.agent.core.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
......@@ -8,9 +8,9 @@ import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.skywalking.apm.api.boot.ServiceManager;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.queue.TraceSegmentProcessQueue;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.queue.TraceSegmentProcessQueue;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
import org.skywalking.apm.trace.SegmentsMessage;
......
package org.skywalking.apm.api.client;
package org.skywalking.apm.agent.core.client;
import org.skywalking.apm.api.boot.StatusBootService;
import org.skywalking.apm.api.queue.TraceSegmentProcessQueue;
import org.skywalking.apm.agent.core.queue.TraceSegmentProcessQueue;
import org.skywalking.apm.agent.core.boot.StatusBootService;
import org.skywalking.apm.trace.TraceSegment;
/**
......
package org.skywalking.apm.api.client;
package org.skywalking.apm.agent.core.client;
/**
* The <code>RESTResponseStatusError</code> represents the REST-Service client got an unexpected response code.
......
package org.skywalking.apm.api.conf;
package org.skywalking.apm.agent.core.conf;
import org.skywalking.apm.api.logging.LogLevel;
import org.skywalking.apm.api.logging.WriterFactory;
import org.skywalking.apm.agent.core.logging.LogLevel;
import org.skywalking.apm.agent.core.logging.WriterFactory;
/**
* This is the core config in sniffer agent.
......
package org.skywalking.apm.api.conf;
package org.skywalking.apm.agent.core.conf;
public class Constants {
public static String PATH_SEPARATOR = System.getProperty("file.separator", "/");
......
package org.skywalking.apm.api.conf;
package org.skywalking.apm.agent.core.conf;
import org.skywalking.apm.api.util.ConfigInitializer;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.util.ConfigInitializer;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.context;
package org.skywalking.apm.agent.core.context;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceId.DistributedTraceId;
import org.skywalking.apm.trace.TraceId.PropagatedTraceId;
......
package org.skywalking.apm.api.context;
package org.skywalking.apm.agent.core.context;
import org.skywalking.apm.api.boot.BootService;
import org.skywalking.apm.agent.core.boot.BootService;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceSegment;
......
package org.skywalking.apm.api.context;
package org.skywalking.apm.agent.core.context;
import org.skywalking.apm.api.boot.ServiceManager;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.sampling.SamplingService;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.sampling.SamplingService;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceSegment;
import org.skywalking.apm.trace.TraceSegmentRef;
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogResolver;
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.skywalking.apm.api.conf.Constants;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.conf.Constants;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.logging.ILog;
import java.io.ByteArrayOutputStream;
......@@ -10,9 +11,6 @@ import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import static org.skywalking.apm.api.conf.Config.Logging.LEVEL;
import static org.skywalking.apm.api.logging.LogLevel.*;
/**
* The <code>EasyLogger</code> is a simple implementation of {@link ILog}.
*
......@@ -72,71 +70,71 @@ public class EasyLogger implements ILog {
@Override
public void info(String format) {
if (isInfoEnable())
logger(INFO, format, null);
logger(LogLevel.INFO, format, null);
}
@Override
public void info(String format, Object... arguments) {
if (isInfoEnable())
logger(INFO, replaceParam(format, arguments), null);
logger(LogLevel.INFO, replaceParam(format, arguments), null);
}
@Override
public void warn(String format, Object... arguments) {
if (isWarnEnable())
logger(WARN, replaceParam(format, arguments), null);
logger(LogLevel.WARN, replaceParam(format, arguments), null);
}
@Override
public void error(String format, Throwable e) {
if (isErrorEnable())
logger(ERROR, format, e);
logger(LogLevel.ERROR, format, e);
}
@Override
public void error(Throwable e, String format, Object... arguments) {
if (isErrorEnable())
logger(ERROR, replaceParam(format, arguments), e);
logger(LogLevel.ERROR, replaceParam(format, arguments), e);
}
@Override
public boolean isDebugEnable() {
return DEBUG.compareTo(LEVEL) >= 0;
return LogLevel.DEBUG.compareTo(Config.Logging.LEVEL) >= 0;
}
@Override
public boolean isInfoEnable() {
return INFO.compareTo(LEVEL) >= 0;
return LogLevel.INFO.compareTo(Config.Logging.LEVEL) >= 0;
}
@Override
public boolean isWarnEnable() {
return WARN.compareTo(LEVEL) >= 0;
return LogLevel.WARN.compareTo(Config.Logging.LEVEL) >= 0;
}
@Override
public boolean isErrorEnable() {
return ERROR.compareTo(LEVEL) >= 0;
return LogLevel.ERROR.compareTo(Config.Logging.LEVEL) >= 0;
}
@Override
public void debug(String format) {
if (isDebugEnable()) {
logger(DEBUG, format, null);
logger(LogLevel.DEBUG, format, null);
}
}
@Override
public void debug(String format, Object... arguments) {
if (isDebugEnable()) {
logger(DEBUG, replaceParam(format, arguments), null);
logger(LogLevel.DEBUG, replaceParam(format, arguments), null);
}
}
@Override
public void error(String format) {
if (isErrorEnable()) {
logger(ERROR, format, null);
logger(LogLevel.ERROR, format, null);
}
}
}
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import com.lmax.disruptor.EventFactory;
import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.util.DaemonThreadFactory;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.conf.Constants;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.conf.Constants;
import java.io.File;
import java.io.FileNotFoundException;
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
public interface IWriter {
void write(String message);
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
/**
* The <code>LogMessageHolder</code> is a {@link String} holder,
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.util.StringUtil;
public class WriterFactory {
public static IWriter getLogWriter() {
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.pool.TypePool;
import net.bytebuddy.pool.TypePool.Resolution;
import org.skywalking.apm.api.plugin.interceptor.enhance.ClassEnhancePluginDefine;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.pool.TypePool;
import org.skywalking.apm.logging.ILog;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.util.StringUtil;
import java.io.BufferedReader;
import java.io.IOException;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
public class PluginException extends RuntimeException {
private static final long serialVersionUID = -6020188711867490724L;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import java.util.HashMap;
import java.util.List;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.dynamic.ClassFileLocator;
......
package org.skywalking.apm.api.plugin.bytebuddy;
package org.skywalking.apm.agent.core.plugin.bytebuddy;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
......
package org.skywalking.apm.api.plugin.bytebuddy;
package org.skywalking.apm.agent.core.plugin.bytebuddy;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.method.ParameterList;
......
package org.skywalking.apm.api.plugin.interceptor;
package org.skywalking.apm.agent.core.plugin.interceptor;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
......
package org.skywalking.apm.api.plugin.interceptor;
package org.skywalking.apm.agent.core.plugin.interceptor;
import org.skywalking.apm.api.plugin.PluginException;
import org.skywalking.apm.agent.core.plugin.PluginException;
public class EnhanceException extends PluginException {
private static final long serialVersionUID = -2234782755784217255L;
......
package org.skywalking.apm.api.plugin.interceptor;
package org.skywalking.apm.agent.core.plugin.interceptor;
import org.skywalking.apm.api.plugin.AbstractClassEnhancePluginDefine;
import org.skywalking.apm.api.plugin.interceptor.enhance.ClassEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
......
package org.skywalking.apm.api.plugin.interceptor;
package org.skywalking.apm.agent.core.plugin.interceptor;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
......
package org.skywalking.apm.api.plugin.interceptor;
package org.skywalking.apm.agent.core.plugin.interceptor;
public class InterceptorException extends RuntimeException {
private static final long serialVersionUID = 7846035239994885019L;
......
package org.skywalking.apm.api.plugin.interceptor;
package org.skywalking.apm.agent.core.plugin.interceptor;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
......
package org.skywalking.apm.api.plugin.interceptor.assist;
package org.skywalking.apm.agent.core.plugin.interceptor.assist;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.api.plugin.interceptor.InterceptorException;
import org.skywalking.apm.api.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.InterceptorException;
/**
* {@link NoConcurrencyAccessObject} is method invocation counter,
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.api.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.dynamic.DynamicType;
......@@ -6,10 +6,14 @@ import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.SuperMethodCall;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.matcher.ElementMatchers;
import org.skywalking.apm.api.plugin.AbstractClassEnhancePluginDefine;
import org.skywalking.apm.api.plugin.PluginException;
import org.skywalking.apm.api.plugin.interceptor.*;
import org.skywalking.apm.api.util.StringUtil;
import org.skywalking.apm.agent.core.plugin.PluginException;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhanceException;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.util.StringUtil;
import org.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import org.skywalking.apm.api.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
/**
* Plugins, which only need enhance class static methods. Actually, inherit from {@link
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.*;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.api.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import org.skywalking.apm.api.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.api.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
/**
* Plugins, which only need enhance class static methods. Actually, inherit from {@link
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.Origin;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
import org.skywalking.apm.api.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.agent.core.plugin.interceptor.loader.InterceptorInstanceLoader;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldProxy;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
public interface FieldGetter {
Object getValue();
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
public interface FieldSetter {
void setValue(Object value);
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
/**
* The instance constructor's interceptor interface.
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
/**
* A interceptor, which intercept method's invocation. The target methods will be defined in {@link
......
package org.skywalking.apm.api.plugin.interceptor.enhance;
package org.skywalking.apm.agent.core.plugin.interceptor.enhance;
/**
* This is a method return value manipulator. When a interceptor's method, such as {@link
* InstanceMethodsAroundInterceptor#beforeMethod(org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext, InstanceMethodInvokeContext,
* InstanceMethodsAroundInterceptor#beforeMethod(org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext, InstanceMethodInvokeContext,
* MethodInterceptResult)}, has this as a method argument, the interceptor can manipulate the method's return value. <p>
* The new value set to this object, by {@link MethodInterceptResult#defineReturnValue(Object)}, will override the
* origin return value.
......
package org.skywalking.apm.api.plugin.interceptor.loader;
package org.skywalking.apm.agent.core.plugin.interceptor.loader;
import org.skywalking.apm.api.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.api.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.api.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
......
package org.skywalking.apm.api.queue;
package org.skywalking.apm.agent.core.queue;
import com.lmax.disruptor.EventFactory;
import org.skywalking.apm.trace.TraceSegment;
......
package org.skywalking.apm.api.queue;
package org.skywalking.apm.agent.core.queue;
import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.util.DaemonThreadFactory;
import org.skywalking.apm.api.boot.StatusBootService;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.context.TracerContext;
import org.skywalking.apm.api.context.TracerContextListener;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.boot.StatusBootService;
import org.skywalking.apm.agent.core.context.TracerContext;
import org.skywalking.apm.agent.core.context.TracerContextListener;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
import org.skywalking.apm.trace.TraceSegment;
......
package org.skywalking.apm.api.sampling;
package org.skywalking.apm.agent.core.sampling;
/**
* Use <code>IllegalSamplingRateException</code>, only if the rate can not be supported.
......
package org.skywalking.apm.api.sampling;
package org.skywalking.apm.agent.core.sampling;
import org.skywalking.apm.api.boot.BootService;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.context.ContextCarrier;
import org.skywalking.apm.agent.core.boot.BootService;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.context.ContextCarrier;
import org.skywalking.apm.logging.ILog;
import org.skywalking.apm.logging.LogManager;
import org.skywalking.apm.trace.TraceSegment;
......
org.skywalking.apm.agent.core.queue.TraceSegmentProcessQueue
org.skywalking.apm.agent.core.context.ContextManager
org.skywalking.apm.agent.core.client.CollectorClientService
org.skywalking.apm.agent.core.sampling.SamplingService
package org.skywalking.apm.api.boot;
package org.skywalking.apm.agent.core.boot;
import org.junit.Assert;
import org.junit.Test;
import org.skywalking.apm.api.context.ContextManager;
import org.skywalking.apm.agent.core.context.ContextManager;
/**
* @author wusheng
......
package org.skywalking.apm.api.client;
package org.skywalking.apm.agent.core.client;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
......
package org.skywalking.apm.api.conf;
package org.skywalking.apm.agent.core.conf;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import static org.skywalking.apm.api.logging.LogLevel.DEBUG;
import static org.skywalking.apm.api.logging.LogLevel.INFO;
import org.skywalking.apm.agent.core.logging.LogLevel;
/**
* @author wusheng
......@@ -24,11 +22,11 @@ public class SnifferConfigInitializerTest {
Assert.assertNotNull(Config.Logging.FILE_NAME);
Assert.assertNotNull(Config.Logging.MAX_FILE_SIZE);
Assert.assertNotNull(Config.Logging.FILE_NAME);
Assert.assertEquals(INFO, Config.Logging.LEVEL);
Assert.assertEquals(LogLevel.INFO, Config.Logging.LEVEL);
}
@AfterClass
public static void clear() {
Config.Logging.LEVEL = DEBUG;
Config.Logging.LEVEL = LogLevel.DEBUG;
}
}
package org.skywalking.apm.api.context;
package org.skywalking.apm.agent.core.context;
import org.junit.After;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.skywalking.apm.api.boot.ServiceManager;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceSegment;
import org.skywalking.apm.trace.tag.Tags;
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.skywalking.apm.api.conf.Constants;
import org.skywalking.apm.agent.core.conf.Constants;
import java.io.PrintStream;
......@@ -60,7 +60,7 @@ public class EasyLoggerTest {
String formatLines = logger.format(exception);
String[] lines = formatLines.split(Constants.LINE_SEPARATOR);
Assert.assertEquals("java.lang.NullPointerException", lines[1]);
Assert.assertEquals("\tat org.skywalking.apm.api.logging.EasyLoggerTest.testFormat(EasyLoggerTest.java:58)", lines[2]);
Assert.assertEquals("\tat org.skywalking.apm.agent.core.logging.EasyLoggerTest.testFormat(EasyLoggerTest.java:58)", lines[2]);
}
@AfterClass
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.api.conf.Constants;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.conf.Constants;
import java.io.File;
import java.io.IOException;
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.junit.AfterClass;
import org.junit.BeforeClass;
......
package org.skywalking.apm.api.logging;
package org.skywalking.apm.agent.core.logging;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.skywalking.apm.api.conf.Config;
import org.skywalking.apm.agent.core.conf.Config;
import java.io.PrintStream;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
......@@ -12,7 +12,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
import org.skywalking.apm.api.plugin.utility.ClassFileExtraction;
import org.skywalking.apm.agent.core.plugin.utility.ClassFileExtraction;
import java.lang.instrument.ClassFileTransformer;
......@@ -21,8 +21,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(PowerMockRunner.class)
public class AbstractClassEnhancePluginDefineTest {
static final String WEAVE_CLASS = "org.skywalking.apm.api.plugin.TargetObject";
static final String INTERCEPTOR_CLASS = "org.skywalking.apm.api.plugin.MockPluginInterceptor";
static final String WEAVE_CLASS = "org.skywalking.apm.agent.core.plugin.pluginTargetObject";
static final String INTERCEPTOR_CLASS = "org.skywalking.apm.agent.core.plugin.MockPluginInterceptor";
static final String WEAVE_INSTANCE_METHOD_NAME = "instanceMethod";
static final String WEAVE_INSTANCE_WITH_EXCEPTION_METHOD_NAME = "instanceMethodWithException";
static final String WEAVE_STATIC_METHOD_NAME = "staticMethod";
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.api.plugin.bytebuddy.AllObjectDefaultMethodsMatch;
import org.skywalking.apm.api.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.api.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.skywalking.apm.api.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.bytebuddy.AllObjectDefaultMethodsMatch;
import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import static net.bytebuddy.matcher.ElementMatchers.*;
import static org.skywalking.apm.api.plugin.AbstractClassEnhancePluginDefineTest.*;
public class MockPluginInstanceMethodInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
@Override
protected String enhanceClassName() {
return WEAVE_CLASS;
return AbstractClassEnhancePluginDefineTest.WEAVE_CLASS;
}
@Override
......@@ -27,7 +26,7 @@ public class MockPluginInstanceMethodInstrumentation extends ClassInstanceMethod
@Override
public String getConstructorInterceptor() {
return INTERCEPTOR_CLASS;
return AbstractClassEnhancePluginDefineTest.INTERCEPTOR_CLASS;
}
}
};
......@@ -39,23 +38,23 @@ public class MockPluginInstanceMethodInstrumentation extends ClassInstanceMethod
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named(WEAVE_INSTANCE_METHOD_NAME).and(not(AllObjectDefaultMethodsMatch.INSTANCE));
return named(AbstractClassEnhancePluginDefineTest.WEAVE_INSTANCE_METHOD_NAME).and(not(AllObjectDefaultMethodsMatch.INSTANCE));
}
@Override
public String getMethodsInterceptor() {
return INTERCEPTOR_CLASS;
return AbstractClassEnhancePluginDefineTest.INTERCEPTOR_CLASS;
}
},
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named(WEAVE_INSTANCE_WITH_EXCEPTION_METHOD_NAME);
return named(AbstractClassEnhancePluginDefineTest.WEAVE_INSTANCE_WITH_EXCEPTION_METHOD_NAME);
}
@Override
public String getMethodsInterceptor() {
return INTERCEPTOR_CLASS;
return AbstractClassEnhancePluginDefineTest.INTERCEPTOR_CLASS;
}
}
};
......
package org.skywalking.apm.api.plugin;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.api.plugin.interceptor.enhance.*;
package org.skywalking.apm.agent.core.plugin;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
public class MockPluginInterceptor implements InstanceMethodsAroundInterceptor, StaticMethodsAroundInterceptor, InstanceConstructorInterceptor {
@Override
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.skywalking.apm.api.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.api.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static org.skywalking.apm.api.plugin.AbstractClassEnhancePluginDefineTest.*;
public class MockPluginStaticMethodInstrumentation extends ClassStaticMethodsEnhancePluginDefine {
@Override
protected String enhanceClassName() {
return WEAVE_CLASS;
return AbstractClassEnhancePluginDefineTest.WEAVE_CLASS;
}
@Override
......@@ -20,12 +19,12 @@ public class MockPluginStaticMethodInstrumentation extends ClassStaticMethodsEnh
new StaticMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named(WEAVE_STATIC_METHOD_NAME);
return named(AbstractClassEnhancePluginDefineTest.WEAVE_STATIC_METHOD_NAME);
}
@Override
public String getMethodsInterceptor() {
return INTERCEPTOR_CLASS;
return AbstractClassEnhancePluginDefineTest.INTERCEPTOR_CLASS;
}
}
};
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import org.junit.After;
import org.junit.Assert;
......
package org.skywalking.apm.api.plugin;
package org.skywalking.apm.agent.core.plugin;
import net.bytebuddy.dynamic.DynamicType;
import org.junit.Assert;
......
package org.skywalking.apm.api.plugin.assist;
package org.skywalking.apm.agent.core.plugin.assist;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.skywalking.apm.api.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.api.plugin.interceptor.assist.NoConcurrencyAccessObject;
import org.skywalking.apm.api.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext;
import org.skywalking.apm.agent.core.plugin.interceptor.assist.NoConcurrencyAccessObject;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodInvokeContext;
/**
* @author wusheng
......
package org.skywalking.apm.api.plugin.bytebuddy;
package org.skywalking.apm.agent.core.plugin.bytebuddy;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.method.ParameterDescription;
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册