fix compile issues
This commit is contained in:
parent
96f6c5fad9
commit
b69cd85149
|
|
@ -39,7 +39,7 @@ public class SpanTestCase {
|
|||
Span span1 = new Span(0, "serviceA");
|
||||
Tags.SPAN_LAYER.asHttp(span1);
|
||||
Tags.COMPONENT.set(span1, "Spring");
|
||||
Tags.PEER_HOST.set(span1, ipToInt("127.0.0.1"));
|
||||
Tags.PEER_HOST.set(span1, "127.0.0.1");
|
||||
Tags.ERROR.set(span1, true);
|
||||
Tags.STATUS_CODE.set(span1, 302);
|
||||
Tags.URL.set(span1, "http://127.0.0.1/serviceA");
|
||||
|
|
@ -49,40 +49,10 @@ public class SpanTestCase {
|
|||
Map<String, Object> tags = span1.getTags();
|
||||
Assert.assertEquals(8, tags.size());
|
||||
Assert.assertTrue(Tags.SPAN_LAYER.isHttp(span1));
|
||||
Assert.assertEquals("127.0.0.1", intToIp(Tags.PEER_HOST.get(span1)));
|
||||
Assert.assertEquals("127.0.0.1", Tags.PEER_HOST.get(span1));
|
||||
Assert.assertTrue(Tags.ERROR.get(span1));
|
||||
}
|
||||
|
||||
private int ipToInt(String ipAddress) {
|
||||
int result = 0;
|
||||
String[] ipAddressInArray = ipAddress.split("\\.");
|
||||
|
||||
for (int i = 3; i >= 0; i--) {
|
||||
|
||||
int ip = Integer.parseInt(ipAddressInArray[3 - i]);
|
||||
|
||||
//left shifting 24,16,8,0 and bitwise OR
|
||||
//1. 192 << 24
|
||||
//1. 168 << 16
|
||||
//1. 1 << 8
|
||||
//1. 2 << 0
|
||||
result |= ip << (i * 8);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String intToIp(int longIp) {
|
||||
StringBuffer sb = new StringBuffer("");
|
||||
sb.append(String.valueOf((longIp >>> 24)));
|
||||
sb.append(".");
|
||||
sb.append(String.valueOf((longIp & 0x00FFFFFF) >>> 16));
|
||||
sb.append(".");
|
||||
sb.append(String.valueOf((longIp & 0x0000FFFF) >>> 8));
|
||||
sb.append(".");
|
||||
sb.append(String.valueOf((longIp & 0x000000FF)));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogException(){
|
||||
Span span1 = new Span(0, "serviceA");
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ package com.a.eye.skywalking.api.logging;
|
|||
|
||||
|
||||
import com.a.eye.skywalking.api.logging.api.ILog;
|
||||
import com.a.eye.skywalking.util.LoggingUtil;
|
||||
|
||||
import com.a.eye.skywalking.api.util.LoggingUtil;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.a.eye.skywalking.logging.LogLevel.*;
|
||||
import static com.a.eye.skywalking.api.logging.LogLevel.*;
|
||||
|
||||
/**
|
||||
* Created by xin on 16-6-23.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.a.eye.skywalking.api.logging;
|
||||
|
||||
|
||||
import com.a.eye.skywalking.conf.Config;
|
||||
import com.a.eye.skywalking.util.LoggingUtil;
|
||||
|
||||
import com.a.eye.skywalking.api.conf.Config;
|
||||
import com.a.eye.skywalking.api.util.LoggingUtil;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.a.eye.skywalking.api.logging;
|
||||
|
||||
import com.a.eye.skywalking.conf.Config;
|
||||
import com.a.eye.skywalking.api.conf.Config;
|
||||
|
||||
public class WriterFactory {
|
||||
private WriterFactory(){
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.a.eye.skywalking.api.plugin.interceptor;
|
||||
|
||||
import com.a.eye.skywalking.plugin.PluginException;
|
||||
import com.a.eye.skywalking.api.plugin.PluginException;
|
||||
|
||||
public class EnhanceException extends PluginException {
|
||||
private static final long serialVersionUID = -2234782755784217255L;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.a.eye.skywalking.api.plugin.interceptor.assist;
|
||||
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.InterceptorException;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.InterceptorException;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,12 @@ package com.a.eye.skywalking.api.plugin.interceptor.enhance;
|
|||
import com.a.eye.skywalking.api.logging.api.ILog;
|
||||
import com.a.eye.skywalking.api.logging.api.LogManager;
|
||||
import com.a.eye.skywalking.api.plugin.AbstractClassEnhancePluginDefine;
|
||||
import com.a.eye.skywalking.plugin.PluginException;
|
||||
import com.a.eye.skywalking.api.plugin.PluginException;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.EnhanceException;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.api.util.StringUtil;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.dynamic.DynamicType;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.a.eye.skywalking.api.plugin.interceptor.enhance;
|
||||
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
|
||||
/**
|
||||
* Plugins, which only need enhance class static methods.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.a.eye.skywalking.api.plugin.interceptor.enhance;
|
||||
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint;
|
||||
|
||||
/**
|
||||
* Plugins, which only need enhance class static methods.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.a.eye.skywalking.api.queue;
|
||||
|
||||
import com.a.eye.skywalking.conf.Config;
|
||||
import com.a.eye.skywalking.api.conf.Config;
|
||||
import com.a.eye.skywalking.api.context.TracerContext;
|
||||
import com.a.eye.skywalking.context.TracerContextListener;
|
||||
import com.a.eye.skywalking.api.context.TracerContextListener;
|
||||
import com.a.eye.skywalking.health.report.HealthCollector;
|
||||
import com.a.eye.skywalking.health.report.HeathReading;
|
||||
import com.a.eye.skywalking.trace.TraceSegment;
|
||||
|
|
@ -36,7 +36,7 @@ public enum TraceSegmentProcessQueue implements TracerContextListener {
|
|||
RingBuffer<TraceSegmentHolder> buffer;
|
||||
|
||||
TraceSegmentProcessQueue() {
|
||||
disruptor = new Disruptor<>(TraceSegmentHolder.Factory.INSTANCE, Config.Disruptor.BUFFER_SIZE, DaemonThreadFactory.INSTANCE);
|
||||
disruptor = new Disruptor<TraceSegmentHolder>(TraceSegmentHolder.Factory.INSTANCE, Config.Disruptor.BUFFER_SIZE, DaemonThreadFactory.INSTANCE);
|
||||
buffer = disruptor.getRingBuffer();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.a.eye.skywalking.api.util;
|
||||
|
||||
import com.a.eye.skywalking.conf.Constants;
|
||||
import com.a.eye.skywalking.api.conf.Constants;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class TraceIdGenerator {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
package com.a.eye.skywalking.api.plugin;
|
||||
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import com.a.eye.skywalking.api.plugin.interceptor.ConstructorInterceptPoint;
|
|||
import com.a.eye.skywalking.api.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.ClassEnhancePluginDefine;
|
||||
import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import com.a.eye.skywalking.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.a.eye.skywalking.api.plugin;
|
||||
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInvokeContext;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.MethodInvokeContext;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.StaticMethodInvokeContext;
|
||||
import com.a.eye.skywalking.api.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.a.eye.skywalking.sniffer.mock;
|
||||
|
||||
import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener;
|
||||
import com.a.eye.skywalking.sniffer.mock.trace.TraceSegmentBuilderFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 2017/2/21.
|
||||
*/
|
||||
public class MockTracerContextListenerTestCase {
|
||||
@Test
|
||||
public void testAfterFinished(){
|
||||
MockTracerContextListener listener = new MockTracerContextListener();
|
||||
listener.afterFinished(TraceSegmentBuilderFactory.INSTANCE.singleTomcat200Trace());
|
||||
|
||||
Assert.assertNotNull(listener.getFinished(0));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue