提交 4e2768d7 编写于 作者: wu-sheng's avatar wu-sheng

Fix some compile issues.

上级 6745e50f
...@@ -285,7 +285,7 @@ in one of these ways: ...@@ -285,7 +285,7 @@ in one of these ways:
Corresponding Source, you remain obligated to ensure that it is Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements. available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided e) Convey the object code using peer_host-to-peer_host transmission, provided
you inform other peers where the object code and Corresponding you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no Source of the work are being offered to the general public at no
charge under subsection 6d. charge under subsection 6d.
...@@ -436,7 +436,7 @@ material under section 10. ...@@ -436,7 +436,7 @@ material under section 10.
You are not required to accept this License in order to receive or You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission occurring solely as a consequence of using peer_host-to-peer_host transmission
to receive a copy likewise does not require acceptance. However, to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do modify any covered work. These actions infringe copyright if you do
......
...@@ -4,16 +4,16 @@ import com.google.gson.Gson; ...@@ -4,16 +4,16 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapter;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.Collections;
import org.skywalking.apm.trace.TraceId.DistributedTraceIds; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.skywalking.apm.trace.tag.BooleanTagItem; import org.skywalking.apm.trace.tag.BooleanTagItem;
import org.skywalking.apm.trace.tag.IntTagItem; import org.skywalking.apm.trace.tag.IntTagItem;
import org.skywalking.apm.trace.tag.StringTagItem; import org.skywalking.apm.trace.tag.StringTagItem;
...@@ -30,7 +30,7 @@ import org.skywalking.apm.util.StringUtil; ...@@ -30,7 +30,7 @@ import org.skywalking.apm.util.StringUtil;
*/ */
@JsonAdapter(Span.Serializer.class) @JsonAdapter(Span.Serializer.class)
public class Span { public class Span {
private static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); private static Gson SERIALIZATION_GSON = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
private int spanId; private int spanId;
private int parentSpanId; private int parentSpanId;
...@@ -53,10 +53,10 @@ public class Span { ...@@ -53,10 +53,10 @@ public class Span {
private String operationName; private String operationName;
/** /**
* {@link #peer}, {@link #port} and {@link #peers} were part of tags, * {@link #peer_host}, {@link #port} and {@link #peers} were part of tags,
* independence them from tags for better performance and gc. * independence them from tags for better performance and gc.
*/ */
private String peer; private String peer_host;
private int port; private int port;
...@@ -334,8 +334,8 @@ public class Span { ...@@ -334,8 +334,8 @@ public class Span {
return false; return false;
} }
public String getPeer() { public String getPeerHost() {
return peer; return peer_host;
} }
public int getPort() { public int getPort() {
...@@ -346,8 +346,8 @@ public class Span { ...@@ -346,8 +346,8 @@ public class Span {
return peers; return peers;
} }
public void setPeer(String peer) { public void setPeer_host(String peer_host) {
this.peer = peer; this.peer_host = peer_host;
} }
public void setPort(int port) { public void setPort(int port) {
...@@ -380,8 +380,8 @@ public class Span { ...@@ -380,8 +380,8 @@ public class Span {
this.writeTags(out, span); this.writeTags(out, span);
if(span.logs != null) { if (span.logs != null) {
out.name("logs").jsonValue(gson.toJson(span.logs)); out.name("logs").jsonValue(SERIALIZATION_GSON.toJson(span.logs));
} }
out.endObject(); out.endObject();
...@@ -391,9 +391,9 @@ public class Span { ...@@ -391,9 +391,9 @@ public class Span {
JsonObject tagWithStr = null; JsonObject tagWithStr = null;
JsonObject tagWithInt = null; JsonObject tagWithInt = null;
JsonObject tagWithBool = null; JsonObject tagWithBool = null;
if (!StringUtil.isEmpty(span.peer)) { if (!StringUtil.isEmpty(span.peer_host)) {
tagWithStr = new JsonObject(); tagWithStr = new JsonObject();
tagWithStr.addProperty("peer.host", span.peer); tagWithStr.addProperty("peer.host", span.peer_host);
tagWithInt = new JsonObject(); tagWithInt = new JsonObject();
tagWithInt.addProperty("peer.port", span.port); tagWithInt.addProperty("peer.port", span.port);
} else if (!StringUtil.isEmpty(span.peers)) { } else if (!StringUtil.isEmpty(span.peers)) {
......
...@@ -8,7 +8,6 @@ import org.skywalking.apm.trace.tag.StringTagReader; ...@@ -8,7 +8,6 @@ import org.skywalking.apm.trace.tag.StringTagReader;
import org.skywalking.apm.trace.tag.Tags; import org.skywalking.apm.trace.tag.Tags;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by wusheng on 2017/2/18. * Created by wusheng on 2017/2/18.
...@@ -45,14 +44,14 @@ public class SpanTestCase { ...@@ -45,14 +44,14 @@ public class SpanTestCase {
Span span1 = new Span(0, "serviceA"); Span span1 = new Span(0, "serviceA");
Tags.SPAN_LAYER.asHttp(span1); Tags.SPAN_LAYER.asHttp(span1);
Tags.COMPONENT.set(span1, "Spring"); Tags.COMPONENT.set(span1, "Spring");
span1.setPeer("127.0.0.1"); span1.setPeer_host("127.0.0.1");
Tags.ERROR.set(span1, true); Tags.ERROR.set(span1, true);
Tags.STATUS_CODE.set(span1, 302); Tags.STATUS_CODE.set(span1, 302);
Tags.URL.set(span1, "http://127.0.0.1/serviceA"); Tags.URL.set(span1, "http://127.0.0.1/serviceA");
Tags.DB_STATEMENT.set(span1, "select * from users"); Tags.DB_STATEMENT.set(span1, "select * from users");
Assert.assertEquals("http", StringTagReader.get(span1, Tags.SPAN_LAYER.SPAN_LAYER_TAG)); Assert.assertEquals("http", StringTagReader.get(span1, Tags.SPAN_LAYER.SPAN_LAYER_TAG));
Assert.assertEquals("127.0.0.1", span1.getPeer()); Assert.assertEquals("127.0.0.1", span1.getPeerHost());
Assert.assertTrue(BooleanTagReader.get(span1, Tags.ERROR)); Assert.assertTrue(BooleanTagReader.get(span1, Tags.ERROR));
} }
......
package org.skywalking.apm.agent.core.context; package org.skywalking.apm.agent.core.context;
import org.skywalking.apm.agent.core.conf.Config; import java.util.LinkedList;
import java.util.List;
import org.skywalking.apm.agent.core.boot.ServiceManager; import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.Config;
import org.skywalking.apm.agent.core.sampling.SamplingService; import org.skywalking.apm.agent.core.sampling.SamplingService;
import org.skywalking.apm.trace.Span; import org.skywalking.apm.trace.Span;
import org.skywalking.apm.trace.TraceSegment; import org.skywalking.apm.trace.TraceSegment;
import org.skywalking.apm.trace.TraceSegmentRef; import org.skywalking.apm.trace.TraceSegmentRef;
import org.skywalking.apm.trace.tag.Tags;
import java.util.LinkedList;
import java.util.List;
/** /**
* {@link TracerContext} maintains the context. * {@link TracerContext} maintains the context.
...@@ -148,12 +146,12 @@ public final class TracerContext { ...@@ -148,12 +146,12 @@ public final class TracerContext {
Span span = this.activeSpan(); Span span = this.activeSpan();
carrier.setSpanId(span.getSpanId()); carrier.setSpanId(span.getSpanId());
carrier.setApplicationCode(Config.Agent.APPLICATION_CODE); carrier.setApplicationCode(Config.Agent.APPLICATION_CODE);
String host = Tags.PEER_HOST.get(span); String host = span.getPeerHost();
if (host != null) { if (host != null) {
Integer port = Tags.PEER_PORT.get(span); Integer port = span.getPort();
carrier.setPeerHost(host + ":" + port); carrier.setPeerHost(host + ":" + port);
} else { } else {
carrier.setPeerHost(Tags.PEERS.get(span)); carrier.setPeerHost(span.getPeers());
} }
carrier.setDistributedTraceIds(this.segment.getRelatedGlobalTraces()); carrier.setDistributedTraceIds(this.segment.getRelatedGlobalTraces());
carrier.setSampled(this.segment.isSampled()); carrier.setSampled(this.segment.isSampled());
......
...@@ -18,8 +18,8 @@ public class DubboSpanGenerator { ...@@ -18,8 +18,8 @@ public class DubboSpanGenerator {
Tags.COMPONENT.set(span, "Dubbo"); Tags.COMPONENT.set(span, "Dubbo");
Tags.URL.set(span, "rest://192.168.1.8:20880/default_rpc/org.skywalking.apm.test.persistence.PersistenceService.query(String)"); Tags.URL.set(span, "rest://192.168.1.8:20880/default_rpc/org.skywalking.apm.test.persistence.PersistenceService.query(String)");
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER); Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.PEER_HOST.set(span, "192.168.1.8"); span.setPeer_host("192.168.1.8");
Tags.PEER_PORT.set(span, 20880); span.setPort(20880);
Tags.SPAN_LAYER.asHttp(span); Tags.SPAN_LAYER.asHttp(span);
} }
...@@ -36,7 +36,7 @@ public class DubboSpanGenerator { ...@@ -36,7 +36,7 @@ public class DubboSpanGenerator {
Tags.COMPONENT.set(span, "Dubbo"); Tags.COMPONENT.set(span, "Dubbo");
Tags.URL.set(span, "rest://192.168.1.8:20880/default_rpc/org.skywalking.apm.test.persistence.PersistenceService.query(String)"); Tags.URL.set(span, "rest://192.168.1.8:20880/default_rpc/org.skywalking.apm.test.persistence.PersistenceService.query(String)");
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT); Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
Tags.PEER_HOST.set(span, "10.21.9.35"); span.setPeer_host("10.21.9.35");
Tags.SPAN_LAYER.asHttp(span); Tags.SPAN_LAYER.asHttp(span);
} }
......
...@@ -16,8 +16,8 @@ public class MySQLGenerator { ...@@ -16,8 +16,8 @@ public class MySQLGenerator {
Span span = ContextManager.createSpan("mysql/jdbi/statement/executeQuery"); Span span = ContextManager.createSpan("mysql/jdbi/statement/executeQuery");
Tags.COMPONENT.set(span, "Mysql"); Tags.COMPONENT.set(span, "Mysql");
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT); Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
Tags.PEER_HOST.set(span, "10.5.34.18"); span.setPeer_host("10.5.34.18");
Tags.PEER_PORT.set(span, 30088); span.setPort(30088);
Tags.DB_INSTANCE.set(span, "mysql-instance"); Tags.DB_INSTANCE.set(span, "mysql-instance");
Tags.DB_STATEMENT.set(span, "select * from users where user_id = 1"); Tags.DB_STATEMENT.set(span, "select * from users where user_id = 1");
Tags.DB_TYPE.set(span, "sql"); Tags.DB_TYPE.set(span, "sql");
......
...@@ -19,8 +19,8 @@ public class TomcatSpanGenerator { ...@@ -19,8 +19,8 @@ public class TomcatSpanGenerator {
Tags.COMPONENT.set(webSpan, "Tomcat"); Tags.COMPONENT.set(webSpan, "Tomcat");
Tags.URL.set(webSpan, "http://10.21.9.35/web/serviceA"); Tags.URL.set(webSpan, "http://10.21.9.35/web/serviceA");
Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER); Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER);
Tags.PEER_HOST.set(webSpan, "10.21.9.35"); webSpan.setPeer_host("10.21.9.35");
Tags.PEER_PORT.set(webSpan, 80); webSpan.setPort(80);
Tags.SPAN_LAYER.asHttp(webSpan); Tags.SPAN_LAYER.asHttp(webSpan);
} }
...@@ -41,8 +41,8 @@ public class TomcatSpanGenerator { ...@@ -41,8 +41,8 @@ public class TomcatSpanGenerator {
Tags.COMPONENT.set(webSpan, "Tomcat"); Tags.COMPONENT.set(webSpan, "Tomcat");
Tags.URL.set(webSpan, "http://10.21.9.35/web/unknown"); Tags.URL.set(webSpan, "http://10.21.9.35/web/unknown");
Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER); Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER);
Tags.PEER_HOST.set(webSpan, "10.21.9.35"); webSpan.setPeer_host("10.21.9.35");
Tags.PEER_PORT.set(webSpan, 80); webSpan.setPort(80);
Tags.SPAN_LAYER.asHttp(webSpan); Tags.SPAN_LAYER.asHttp(webSpan);
} }
...@@ -64,8 +64,8 @@ public class TomcatSpanGenerator { ...@@ -64,8 +64,8 @@ public class TomcatSpanGenerator {
Tags.COMPONENT.set(webSpan, "Tomcat"); Tags.COMPONENT.set(webSpan, "Tomcat");
Tags.URL.set(webSpan, "http://10.21.9.35/web/error/service"); Tags.URL.set(webSpan, "http://10.21.9.35/web/error/service");
Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER); Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER);
Tags.PEER_HOST.set(webSpan, "10.21.9.35"); webSpan.setPeer_host("10.21.9.35");
Tags.PEER_PORT.set(webSpan, 80); webSpan.setPort(80);
Tags.SPAN_LAYER.asHttp(webSpan); Tags.SPAN_LAYER.asHttp(webSpan);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册