Fix compile issue.
This commit is contained in:
parent
a23538df38
commit
a656eefcb8
|
|
@ -4,7 +4,6 @@ import com.a.eye.skywalking.api.util.StringUtil;
|
|||
import com.a.eye.skywalking.messages.ISerializable;
|
||||
import com.a.eye.skywalking.trace.messages.proto.KeyValue;
|
||||
import com.a.eye.skywalking.trace.messages.proto.LogDataMessage;
|
||||
import com.a.eye.skywalking.trace.messages.proto.SegmentMessage;
|
||||
import com.a.eye.skywalking.trace.messages.proto.SpanMessage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.a.eye.skywalking.api.context;
|
||||
|
||||
import com.a.eye.skywalking.trace.Span;
|
||||
import com.a.eye.skywalking.trace.TraceSegment;
|
||||
import com.a.eye.skywalking.trace.TraceSegmentRef;
|
||||
import com.a.eye.skywalking.api.util.StringUtil;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -10,7 +12,16 @@ import java.io.Serializable;
|
|||
*
|
||||
* Created by wusheng on 2017/2/17.
|
||||
*/
|
||||
public class ContextCarrier extends TraceSegmentRef implements Serializable {
|
||||
public class ContextCarrier implements Serializable {
|
||||
/**
|
||||
* {@link TraceSegment#traceSegmentId}
|
||||
*/
|
||||
private String traceSegmentId;
|
||||
|
||||
/**
|
||||
* {@link Span#spanId}
|
||||
*/
|
||||
private int spanId = -1;
|
||||
|
||||
/**
|
||||
* Serialize this {@link ContextCarrier} to a {@link String},
|
||||
|
|
@ -51,4 +62,19 @@ public class ContextCarrier extends TraceSegmentRef implements Serializable {
|
|||
return !StringUtil.isEmpty(getTraceSegmentId()) && getSpanId() > -1;
|
||||
}
|
||||
|
||||
public String getTraceSegmentId() {
|
||||
return traceSegmentId;
|
||||
}
|
||||
|
||||
public int getSpanId() {
|
||||
return spanId;
|
||||
}
|
||||
|
||||
public void setTraceSegmentId(String traceSegmentId) {
|
||||
this.traceSegmentId = traceSegmentId;
|
||||
}
|
||||
|
||||
public void setSpanId(int spanId) {
|
||||
this.spanId = spanId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.a.eye.skywalking.api.conf.Config;
|
|||
import com.a.eye.skywalking.trace.Span;
|
||||
import com.a.eye.skywalking.trace.TraceSegment;
|
||||
import com.a.eye.skywalking.api.util.TraceIdGenerator;
|
||||
import com.a.eye.skywalking.trace.TraceSegmentRef;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
|
@ -124,7 +125,10 @@ public final class TracerContext {
|
|||
* ContextCarrier#deserialize(String)} called.
|
||||
*/
|
||||
public void extract(ContextCarrier carrier) {
|
||||
this.segment.ref(carrier);
|
||||
TraceSegmentRef ref = new TraceSegmentRef();
|
||||
ref.setTraceSegmentId(carrier.getTraceSegmentId());
|
||||
ref.setSpanId(carrier.getSpanId());
|
||||
this.segment.ref(ref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
package com.a.eye.skywalking.api.util;
|
||||
|
||||
/**
|
||||
* Created data xin on 2016/12/4.
|
||||
*/
|
||||
public class RoutingKeyGenerator {
|
||||
|
||||
public static int generate(String originData) {
|
||||
char[] value = originData.toCharArray();
|
||||
int h = 0;
|
||||
if (h == 0 && value.length > 0) {
|
||||
char val[] = value;
|
||||
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
h = 31 * h + val[i];
|
||||
}
|
||||
}
|
||||
return h;
|
||||
}
|
||||
}
|
||||
|
|
@ -39,4 +39,8 @@ public final class TraceIdGenerator {
|
|||
Constants.SDK_VERSION + "", System.currentTimeMillis() + "", PROCESS_UUID + "",
|
||||
MachineInfo.getProcessNo() + "", Thread.currentThread().getId() + "", seq + "");
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
System.out.printf(generate());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue