diff --git a/skywalking-sniffer/skywalking-agent/src/main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java b/skywalking-sniffer/skywalking-agent/src/main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java index 8e9cdeca79cfa8a67de7a357d14a1c515da212a8..ea6ba500e33634891355fb909aa475f79c0f0a09 100644 --- a/skywalking-sniffer/skywalking-agent/src/main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java +++ b/skywalking-sniffer/skywalking-agent/src/main/java/com/a/eye/skywalking/agent/SkyWalkingAgent.java @@ -1,7 +1,7 @@ package com.a.eye.skywalking.agent; import com.a.eye.skywalking.agent.junction.SkyWalkingEnhanceMatcher; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.conf.Config; import com.a.eye.skywalking.api.conf.SnifferConfigInitializer; import com.a.eye.skywalking.api.logging.EasyLogResolver; @@ -54,7 +54,7 @@ public class SkyWalkingAgent { final PluginFinder pluginFinder = new PluginFinder(new PluginBootstrap().loadPlugins()); - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); new AgentBuilder.Default().type(enhanceClassMatcher(pluginFinder).and(not(isInterface()))).transform(new AgentBuilder.Transformer() { public DynamicType.Builder transform(DynamicType.Builder builder, TypeDescription typeDescription, ClassLoader classLoader) { diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java similarity index 91% rename from skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java rename to skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java index a01e82b71f9c508398f97d73273c22a47b0e1500..7d56a4986d3cbb51802961317c7e07fd8029b0ee 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceStarter.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/boot/ServiceManager.java @@ -8,12 +8,12 @@ import java.util.Map; import java.util.ServiceLoader; /** - * The ServiceStarter bases on {@link ServiceLoader}, + * The ServiceManager bases on {@link ServiceLoader}, * load all {@link BootService} implementations. * * @author wusheng */ -public enum ServiceStarter { +public enum ServiceManager { INSTANCE; private static ILog logger = LogManager.getLogger(StatusBootService.class); @@ -31,7 +31,7 @@ public enum ServiceStarter { bootService.bootUp(); bootedServices.put(bootService.getClass(), bootService); } catch (Exception e) { - logger.error(e, "ServiceStarter try to start [{}] fail.", bootService.getClass().getName()); + logger.error(e, "ServiceManager try to start [{}] fail.", bootService.getClass().getName()); } } } finally { diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/client/CollectorClientService.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/client/CollectorClientService.java index 84b4a1ad18cbaceb18dfa748f6da8d694f9616d0..1adf187510bed043d743fa5f69f86f76cd0bc1ca 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/client/CollectorClientService.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/client/CollectorClientService.java @@ -1,13 +1,62 @@ package com.a.eye.skywalking.api.client; import com.a.eye.skywalking.api.boot.BootService; +import com.a.eye.skywalking.api.boot.ServiceManager; +import com.a.eye.skywalking.api.queue.TraceSegmentProcessQueue; +import com.a.eye.skywalking.logging.ILog; +import com.a.eye.skywalking.logging.LogManager; +import com.a.eye.skywalking.trace.TraceSegment; +import java.util.List; /** * @author wusheng */ -public class CollectorClientService implements BootService { +public class CollectorClientService implements Runnable, BootService { + private static ILog logger = LogManager.getLogger(CollectorClientService.class); + private static long NO_DATA_SLEEP_TIME_MILLIS = 500; + + /** + * Start a new {@link Thread} to get finished {@link TraceSegment} by {@link TraceSegmentProcessQueue#getCachedTraceSegments()} + */ @Override public void bootUp() { + Thread collectorClientThread = new Thread(this, "collectorClientThread"); + collectorClientThread.start(); + } + + @Override + public void run() { + while (true) { + try { + TraceSegmentProcessQueue segmentProcessQueue = ServiceManager.INSTANCE.findService(TraceSegmentProcessQueue.class); + List cachedTraceSegments = segmentProcessQueue.getCachedTraceSegments(); + if (cachedTraceSegments.size() > 0) { + for (TraceSegment segment : cachedTraceSegments) { + //TODO: wusheng + //send data + } + /** + * No sleep, when exist finished {@link TraceSegment}. + */ + } else { + try2Sleep(NO_DATA_SLEEP_TIME_MILLIS); + } + } catch (Throwable t) { + logger.error(t, "Send trace segments to collector failure."); + } + } + } + + /** + * Try to sleep, and ignore the {@link InterruptedException} + * + * @param millis the length of time to sleep in milliseconds + */ + private void try2Sleep(long millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + } } } diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/Config.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/Config.java index 6ed63537e74bd26cf24b2edb287dd7943b299202..edd49563a1ec094997cac9135c07dc71bf8c8e3f 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/Config.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/conf/Config.java @@ -16,7 +16,7 @@ public class Config { } public static class Disruptor{ - public static int BUFFER_SIZE = 1024 * 4; + public static int BUFFER_SIZE = 512; } diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentHolder.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentHolder.java index 309bc1e532807ec06e58a04d8264972e684c058d..0a5d2b08b5884563119a4259910a09c096a6a45e 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentHolder.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentHolder.java @@ -19,6 +19,10 @@ public final class TraceSegmentHolder { this.value = value; } + public void clear(){ + this.value = null; + } + public enum Factory implements EventFactory { INSTANCE; diff --git a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java index f8eff6e6f88d91ac33437eacc8a865482f00133f..5f82545f403d0640eb4683364dd954617f318880 100644 --- a/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java +++ b/skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/api/queue/TraceSegmentProcessQueue.java @@ -4,10 +4,15 @@ import com.a.eye.skywalking.api.boot.StatusBootService; import com.a.eye.skywalking.api.conf.Config; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.api.context.TracerContextListener; +import com.a.eye.skywalking.logging.ILog; +import com.a.eye.skywalking.logging.LogManager; import com.a.eye.skywalking.trace.TraceSegment; +import com.lmax.disruptor.EventHandler; import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.dsl.Disruptor; import com.lmax.disruptor.util.DaemonThreadFactory; +import java.util.LinkedList; +import java.util.List; /** * {@link TraceSegmentProcessQueue} is a proxy of {@link Disruptor}, High Performance Inter-Thread MQ. @@ -16,12 +21,19 @@ import com.lmax.disruptor.util.DaemonThreadFactory; * * Created by wusheng on 2017/2/17. */ -public class TraceSegmentProcessQueue extends StatusBootService implements TracerContextListener { +public class TraceSegmentProcessQueue extends StatusBootService implements TracerContextListener, EventHandler { + private static ILog logger = LogManager.getLogger(TraceSegmentProcessQueue.class); + private Disruptor disruptor; private RingBuffer buffer; + private TraceSegment[] secondLevelCache; + private volatile int cacheIndex; public TraceSegmentProcessQueue() { disruptor = new Disruptor<>(TraceSegmentHolder.Factory.INSTANCE, Config.Disruptor.BUFFER_SIZE, DaemonThreadFactory.INSTANCE); + secondLevelCache = new TraceSegment[Config.Disruptor.BUFFER_SIZE]; + cacheIndex = 0; + disruptor.handleEventsWith(this); buffer = disruptor.getRingBuffer(); } @@ -33,7 +45,7 @@ public class TraceSegmentProcessQueue extends StatusBootService implements Trace @Override public void afterFinished(TraceSegment traceSegment) { - if(isStarted()) { + if (isStarted()) { long sequence = this.buffer.next(); // Grab the next sequence try { TraceSegmentHolder data = this.buffer.get(sequence); @@ -43,4 +55,42 @@ public class TraceSegmentProcessQueue extends StatusBootService implements Trace } } } + + @Override + public void onEvent(TraceSegmentHolder event, long sequence, boolean endOfBatch) throws Exception { + TraceSegment traceSegment = event.getValue(); + try { + if (secondLevelCache[cacheIndex] == null) { + secondLevelCache[cacheIndex] = traceSegment; + }else{ + /** + * If your application has very high throughput(also called tps/qps), + * this log message will be output in very high frequency. + * And this is not suppose to happen. Disable log.warn or expend {@link Config.Disruptor.BUFFER_SIZE} + */ + logger.warn("TraceSegmentProcessQueue has data conflict. Discard the new TraceSegment."); + } + /** + * increase the {@link #cacheIndex}, if it is out of range, reset it. + */ + cacheIndex++; + if (cacheIndex == secondLevelCache.length) { + cacheIndex = 0; + } + } finally { + event.clear(); + } + } + + public List getCachedTraceSegments(){ + List segmentList = new LinkedList<>(); + for (int i = 0; i < secondLevelCache.length; i++) { + TraceSegment segment = secondLevelCache[i]; + if(segment != null){ + segmentList.add(segment); + secondLevelCache[i] = null; + } + } + return segmentList; + } } diff --git a/skywalking-sniffer/skywalking-api/src/main/resources/META-INF/services/com.a.eye.skywalking.api.boot.BootService b/skywalking-sniffer/skywalking-api/src/main/resources/META-INF/services/com.a.eye.skywalking.api.boot.BootService index a305b07a55d1773222b59b70651cd43eaa4f7dc5..c84f7acacd3dc69c3bbbbb1039ea5115a5b2a8fa 100644 --- a/skywalking-sniffer/skywalking-api/src/main/resources/META-INF/services/com.a.eye.skywalking.api.boot.BootService +++ b/skywalking-sniffer/skywalking-api/src/main/resources/META-INF/services/com.a.eye.skywalking.api.boot.BootService @@ -1,2 +1,3 @@ com.a.eye.skywalking.api.queue.TraceSegmentProcessQueue com.a.eye.skywalking.api.context.ContextManager +com.a.eye.skywalking.api.client.CollectorClientService diff --git a/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/test/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java b/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/test/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java index 65afb04f312bb6c561f7001f24eab0c16f71de33..bdd735f8791b94b0351a0260bef5127a8c330922 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/test/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/dubbo-plugin/src/test/java/com/a/eye/skywalking/plugin/dubbo/DubboInterceptorTest.java @@ -1,6 +1,6 @@ package com.a.eye.skywalking.plugin.dubbo; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext; import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext; @@ -60,7 +60,7 @@ public class DubboInterceptorTest { @Before public void setUp() throws Exception { - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); dubboInterceptor = new DubboInterceptor(); testParam = new RequestParamForTestBelow283(); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/test/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptorTest.java b/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/test/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptorTest.java index 7a0c26f89c3814af6f43aa95cdcfc4f882b809fb..a04c987f9f42e7c1eaa46f159915e1925a68faae 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/test/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptorTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/httpClient-4.x-plugin/src/test/java/com/a/eye/skywalking/plugin/httpClient/v4/HttpClientExecuteInterceptorTest.java @@ -1,6 +1,6 @@ package com.a.eye.skywalking.plugin.httpClient.v4; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext; import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext; @@ -58,7 +58,7 @@ public class HttpClientExecuteInterceptorTest { public void setUp() throws Exception { mockTracerContextListener = new MockTracerContextListener(); - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); httpClientExecuteInterceptor = new HttpClientExecuteInterceptor(); PowerMockito.mock(HttpHost.class); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java index 839fb90ec910a047b94c81a23c86d14ea2c5bac9..bf3e2a23056a8043af6aab1eb5679c20c2bab0c7 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWCallableStatementTest.java @@ -1,13 +1,11 @@ package com.a.eye.skywalking.plugin.jdbc; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener; import com.a.eye.skywalking.sniffer.mock.context.SegmentAssert; -import com.a.eye.skywalking.trace.LogData; import com.a.eye.skywalking.trace.Span; import com.a.eye.skywalking.trace.TraceSegment; -import com.a.eye.skywalking.trace.tag.Tags; import com.mysql.cj.api.jdbc.JdbcConnection; import org.hamcrest.CoreMatchers; @@ -90,7 +88,7 @@ public class SWCallableStatementTest extends AbstractStatementTest { @Before public void setUp() throws Exception { mockTracerContextListener = new MockTracerContextListener(); - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); swConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306/test", new Properties(), jdbcConnection); multiHostConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test", new Properties(), jdbcConnection); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWConnectionTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWConnectionTest.java index b97d7109ef3dcc90e6186bdd27c956a1749d2d59..e72a89b061808770420f6b4bbfc18a9a96c468c8 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWConnectionTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWConnectionTest.java @@ -1,6 +1,6 @@ package com.a.eye.skywalking.plugin.jdbc; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener; import com.a.eye.skywalking.sniffer.mock.context.SegmentAssert; @@ -47,7 +47,7 @@ public class SWConnectionTest extends AbstractStatementTest { @Before public void setUp() throws Exception { - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); mockTracerContextListener = new MockTracerContextListener(); swConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306/test", new Properties(), jdbcConnection); multiHostConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test", new Properties(), jdbcConnection); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java index eaf85b46715bef5a1c52e23d6fa5423a9b45d739..381f390fb65ddc8bce0b896d7ed53ed1b4724354 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SWStatementTest.java @@ -1,13 +1,11 @@ package com.a.eye.skywalking.plugin.jdbc; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener; import com.a.eye.skywalking.sniffer.mock.context.SegmentAssert; -import com.a.eye.skywalking.trace.LogData; import com.a.eye.skywalking.trace.Span; import com.a.eye.skywalking.trace.TraceSegment; -import com.a.eye.skywalking.trace.tag.Tags; import com.mysql.cj.api.jdbc.JdbcConnection; import org.hamcrest.CoreMatchers; @@ -50,7 +48,7 @@ public class SWStatementTest extends AbstractStatementTest { public void setUp() throws Exception { mockTracerContextListener = new MockTracerContextListener(); - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); swConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306/test", new Properties(), jdbcConnection); multiHostConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test", new Properties(), jdbcConnection); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java index 9217d71faa6150e893f48cc1bcb53fa0533b2573..30c7237bc7ca1aebe4529950a94a1d8f2c5a73b5 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jdbc-plugin/src/test/java/com/a/eye/skywalking/plugin/jdbc/SwPreparedStatementTest.java @@ -1,13 +1,11 @@ package com.a.eye.skywalking.plugin.jdbc; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener; import com.a.eye.skywalking.sniffer.mock.context.SegmentAssert; -import com.a.eye.skywalking.trace.LogData; import com.a.eye.skywalking.trace.Span; import com.a.eye.skywalking.trace.TraceSegment; -import com.a.eye.skywalking.trace.tag.Tags; import com.mysql.cj.api.jdbc.JdbcConnection; import org.hamcrest.CoreMatchers; @@ -91,7 +89,7 @@ public class SwPreparedStatementTest extends AbstractStatementTest { public void setUp() throws Exception { mockTracerContextListener = new MockTracerContextListener(); - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); swConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306/test", new Properties(), jdbcConnection); multiHostConnection = new SWConnection("jdbc:mysql://127.0.0.1:3306,127.0.0.1:3309/test", new Properties(), jdbcConnection); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java index f447bd39f4124c7ddf428a9a23fc10968814768c..faf13216bf9635891a7e8704d6c51864fb4dfc3d 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/test/java/com/a/eye/skywalking/plugin/jedis/v2/JedisMethodInterceptorTest.java @@ -1,6 +1,6 @@ package com.a.eye.skywalking.plugin.jedis.v2; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext; import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext; @@ -20,8 +20,6 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import java.sql.SQLException; - import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.KEY_OF_REDIS_HOST; import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.KEY_OF_REDIS_HOSTS; import static com.a.eye.skywalking.plugin.jedis.v2.JedisMethodInterceptor.KEY_OF_REDIS_PORT; @@ -30,7 +28,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -47,7 +44,7 @@ public class JedisMethodInterceptorTest { @Before public void setUp() throws Exception { - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); interceptor = new JedisMethodInterceptor(); mockTracerContextListener = new MockTracerContextListener(); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/test/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptorTest.java b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/test/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptorTest.java index fe25327c8089085a429a6c6e5ed157e9017eb26c..5b7699cd12f37bb9973c95c4fabb3318c84e05d1 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/test/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptorTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/motan-plugin/src/test/java/com/a/eye/skywalking/plugin/motan/MotanConsumerInterceptorTest.java @@ -1,10 +1,9 @@ package com.a.eye.skywalking.plugin.motan; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext; import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext; -import com.a.eye.skywalking.plugin.motan.define.MotanConsumerInstrumentation; import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener; import com.a.eye.skywalking.sniffer.mock.context.SegmentAssert; import com.a.eye.skywalking.trace.LogData; @@ -52,7 +51,7 @@ public class MotanConsumerInterceptorTest { @Before public void setUp() { - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); contextListener = new MockTracerContextListener(); invokeInterceptor = new MotanConsumerInterceptor(); diff --git a/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java b/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java index 47c19cc133e3f5cc04feeb183d6415047ea95d13..e6282b4f2cfbcb8662eab393656c9f7f4ab6ff8e 100644 --- a/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java +++ b/skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/com/a/eye/skywalking/plugin/tomcat78x/TomcatInterceptorTest.java @@ -1,6 +1,6 @@ package com.a.eye.skywalking.plugin.tomcat78x; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.api.context.TracerContext; import com.a.eye.skywalking.api.plugin.interceptor.EnhancedClassInstanceContext; import com.a.eye.skywalking.api.plugin.interceptor.enhance.InstanceMethodInvokeContext; @@ -50,7 +50,7 @@ public class TomcatInterceptorTest { @Before public void setUp() throws Exception { - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); tomcatInterceptor = new TomcatInterceptor(); contextListener = new MockTracerContextListener(); diff --git a/skywalking-sniffer/skywalking-sniffer-mock/src/test/java/com/a/eye/skywalking/sniffer/mock/MockTracerContextListenerTestCase.java b/skywalking-sniffer/skywalking-sniffer-mock/src/test/java/com/a/eye/skywalking/sniffer/mock/MockTracerContextListenerTestCase.java index abf074a3d3cad2d4d2f329419b7426599a5fea32..3218405a26aae04c8ced110c7c5058bacb41cabd 100644 --- a/skywalking-sniffer/skywalking-sniffer-mock/src/test/java/com/a/eye/skywalking/sniffer/mock/MockTracerContextListenerTestCase.java +++ b/skywalking-sniffer/skywalking-sniffer-mock/src/test/java/com/a/eye/skywalking/sniffer/mock/MockTracerContextListenerTestCase.java @@ -1,6 +1,6 @@ package com.a.eye.skywalking.sniffer.mock; -import com.a.eye.skywalking.api.boot.ServiceStarter; +import com.a.eye.skywalking.api.boot.ServiceManager; import com.a.eye.skywalking.sniffer.mock.context.MockTracerContextListener; import com.a.eye.skywalking.sniffer.mock.context.SegmentAssert; import com.a.eye.skywalking.sniffer.mock.trace.TraceSegmentBuilderFactory; @@ -15,7 +15,7 @@ import org.junit.Test; public class MockTracerContextListenerTestCase { @BeforeClass public static void setup(){ - ServiceStarter.INSTANCE.boot(); + ServiceManager.INSTANCE.boot(); } @Test