Merge branch 'master' into apache/readme_update

This commit is contained in:
吴晟 Wu Sheng 2017-12-15 09:32:01 +08:00 committed by GitHub
commit 526c50d4cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 46 additions and 48 deletions

View File

@ -17,5 +17,5 @@ if not defined JAVA_HOME (
set _EXECJAVA=java
)
start "%COLLECTOR_PROCESS_TITLE%" %_EXECJAVA% "%COLLECTOR_OPTS%" -cp "%CLASSPATH%" CollectorBootStartUp
start "%COLLECTOR_PROCESS_TITLE%" %_EXECJAVA% "%COLLECTOR_OPTS%" -cp "%CLASSPATH%" org.apache.skywalking.apm.collector.boot.CollectorBootStartUp
endlocal

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.agent.core.context;
import java.util.LinkedList;
@ -50,6 +49,7 @@ import org.apache.skywalking.apm.agent.core.sampling.SamplingService;
* ContextCarrier} or {@link ContextSnapshot}.
*
* @author wusheng
* @author zhang xin
*/
public class TracingContext implements AbstractTracerContext {
/**
@ -159,7 +159,7 @@ public class TracingContext implements AbstractTracerContext {
this.segment.relatedGlobalTraces(carrier.getDistributedTraceId());
AbstractSpan span = this.activeSpan();
if (span instanceof EntrySpan) {
((EntrySpan)span).ref(ref);
span.ref(ref);
}
}
@ -213,7 +213,9 @@ public class TracingContext implements AbstractTracerContext {
*/
@Override
public void continued(ContextSnapshot snapshot) {
this.segment.ref(new TraceSegmentRef(snapshot));
TraceSegmentRef segmentRef = new TraceSegmentRef(snapshot);
this.segment.ref(segmentRef);
this.activeSpan().ref(segmentRef);
this.segment.relatedGlobalTraces(snapshot.getDistributedTraceId());
}

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.agent.core.context.trace;
import java.util.Map;
@ -110,4 +109,11 @@ public interface AbstractSpan {
String getOperationName();
AbstractSpan setOperationId(int operationId);
/**
* Reference other trace segment.
*
* @param ref segment ref
*/
void ref(TraceSegmentRef ref);
}

View File

@ -16,7 +16,6 @@
*
*/
package org.apache.skywalking.apm.agent.core.context.trace;
import java.util.LinkedList;
@ -64,6 +63,13 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
*/
protected List<LogDataEntity> logs;
/**
* The refs of parent trace segments, except the primary one. For most RPC call, {@link #refs} contains only one
* element, but if this segment is a start span of batch process, the segment faces multi parents, at this moment,
* we use this {@link #refs} to link them.
*/
protected List<TraceSegmentRef> refs;
protected AbstractTracingSpan(int spanId, int parentSpanId, String operationName) {
this.operationName = operationName;
this.operationId = DictionaryUtil.nullValue();
@ -273,7 +279,21 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
spanBuilder.addLogs(log.transform());
}
}
if (this.refs != null) {
for (TraceSegmentRef ref : this.refs) {
spanBuilder.addRefs(ref.transform());
}
}
return spanBuilder;
}
@Override public void ref(TraceSegmentRef ref) {
if (refs == null) {
refs = new LinkedList<TraceSegmentRef>();
}
if (!refs.contains(ref)) {
refs.add(ref);
}
}
}

View File

@ -16,13 +16,9 @@
*
*/
package org.apache.skywalking.apm.agent.core.context.trace;
import java.util.LinkedList;
import java.util.List;
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
import org.apache.skywalking.apm.network.proto.SpanObject;
import org.apache.skywalking.apm.network.trace.component.Component;
/**
@ -38,12 +34,6 @@ import org.apache.skywalking.apm.network.trace.component.Component;
* @author wusheng
*/
public class EntrySpan extends StackBasedTracingSpan {
/**
* The refs of parent trace segments, except the primary one. For most RPC call, {@link #refs} contains only one
* element, but if this segment is a start span of batch process, the segment faces multi parents, at this moment,
* we use this {@link #refs} to link them.
*/
private List<TraceSegmentRef> refs;
private int currentMaxDepth;
@ -136,25 +126,6 @@ public class EntrySpan extends StackBasedTracingSpan {
return false;
}
@Override public SpanObject.Builder transform() {
SpanObject.Builder builder = super.transform();
if (refs != null) {
for (TraceSegmentRef ref : refs) {
builder.addRefs(ref.transform());
}
}
return builder;
}
public void ref(TraceSegmentRef ref) {
if (refs == null) {
refs = new LinkedList<TraceSegmentRef>();
}
if (!refs.contains(ref)) {
refs.add(ref);
}
}
private void clearWhenRestart() {
this.componentId = DictionaryUtil.nullValue();
this.componentName = null;

View File

@ -99,4 +99,7 @@ public class NoopSpan implements AbstractSpan {
@Override public AbstractSpan setOperationId(int operationId) {
return this;
}
@Override public void ref(TraceSegmentRef ref) {
}
}

View File

@ -16,10 +16,9 @@
*
*/
package org.apache.skywalking.apm.plugin.jedis.v2;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.junit.After;
@ -45,7 +44,7 @@ public class JedisClusterConstructorWithListHostAndPortArgInterceptorTest {
@Before
public void setUp() throws Exception {
hostAndPortSet = new HashSet<HostAndPort>();
hostAndPortSet = new LinkedHashSet<HostAndPort>();
interceptor = new JedisClusterConstructorWithListHostAndPortArgInterceptor();
hostAndPortSet.add(new HostAndPort("127.0.0.1", 6379));
hostAndPortSet.add(new HostAndPort("127.0.0.1", 16379));

View File

@ -16,22 +16,19 @@
*
*/
package org.apache.skywalking.apm.plugin.okhttp.v3.define;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import org.apache.skywalking.apm.plugin.okhttp.v3.RealCallInterceptor;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
/**
* {@link RealCallInstrumentation} presents that skywalking intercepts {@link okhttp3.RealCall#RealCall(OkHttpClient,
@ -59,7 +56,7 @@ public class RealCallInstrumentation extends ClassInstanceMethodsEnhancePluginDe
return new ConstructorInterceptPoint[] {
new ConstructorInterceptPoint() {
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
return takesArguments(OkHttpClient.class, Request.class, boolean.class);
return any();
}
@Override public String getConstructorInterceptor() {

View File

@ -42,7 +42,7 @@ import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
*/
public class SkywalkingContinuationActivation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "org.skywalking.apm.toolkit.opentracing.SkywalkingContinuation";
private static final String ENHANCE_CLASS = "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingContinuation";
private static final String CONSTRUCTOR_INTERCEPTOR = "org.apache.skywalking.apm.toolkit.activation.opentracing.continuation.ConstructorInterceptor";
private static final String ACTIVATE_METHOD_INTERCEPTOR = "org.apache.skywalking.apm.toolkit.activation.opentracing.continuation.ActivateInterceptor";

View File

@ -58,10 +58,10 @@ public class SkywalkingSpanActivation extends ClassInstanceMethodsEnhancePluginD
private static final String ENHANCE_CLASS = "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingSpan";
private static final String SPAN_BUILDER_CLASS_NAME = "org.skywalking.apm.toolkit.opentracing.SkywalkingSpanBuilder";
private static final String SPAN_BUILDER_CLASS_NAME = "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingSpanBuilder";
private static final String CONSTRUCTOR_WITH_SPAN_BUILDER_INTERCEPTOR = "org.apache.skywalking.apm.toolkit.activation.opentracing.span.ConstructorWithSpanBuilderInterceptor";
private static final String SKYWALKING_TRACER_CLASS_NAME = "SkywalkingTracer";
private static final String SKYWALKING_TRACER_CLASS_NAME = "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer";
private static final String CONSTRUCTOR_WITH_TRACER_INTERCEPTOR = "org.apache.skywalking.apm.toolkit.activation.opentracing.span.ConstructorWithTracerInterceptor";
private static final String FINISH_METHOD_INTERCEPTOR = "org.apache.skywalking.apm.toolkit.activation.opentracing.span.SpanFinishInterceptor";