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

Fix compile issues.

上级 5ff9a698
......@@ -53,10 +53,10 @@ public class Span {
private String operationName;
/**
* {@link #peer_host}, {@link #port} and {@link #peers} were part of tags,
* {@link #peerHost}, {@link #port} and {@link #peers} were part of tags,
* independence them from tags for better performance and gc.
*/
private String peer_host;
private String peerHost;
private int port;
......@@ -335,7 +335,7 @@ public class Span {
}
public String getPeerHost() {
return peer_host;
return peerHost;
}
public int getPort() {
......@@ -346,8 +346,8 @@ public class Span {
return peers;
}
public void setPeer_host(String peer_host) {
this.peer_host = peer_host;
public void setPeerHost(String peerHost) {
this.peerHost = peerHost;
}
public void setPort(int port) {
......@@ -391,9 +391,9 @@ public class Span {
JsonObject tagWithStr = null;
JsonObject tagWithInt = null;
JsonObject tagWithBool = null;
if (!StringUtil.isEmpty(span.peer_host)) {
if (!StringUtil.isEmpty(span.peerHost)) {
tagWithStr = new JsonObject();
tagWithStr.addProperty("peer.host", span.peer_host);
tagWithStr.addProperty("peer.host", span.peerHost);
tagWithInt = new JsonObject();
tagWithInt.addProperty("peer.port", span.port);
} else if (!StringUtil.isEmpty(span.peers)) {
......
......@@ -44,7 +44,7 @@ public class SpanTestCase {
Span span1 = new Span(0, "serviceA");
Tags.SPAN_LAYER.asHttp(span1);
Tags.COMPONENT.set(span1, "Spring");
span1.setPeer_host("127.0.0.1");
span1.setPeerHost("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");
......
......@@ -54,8 +54,8 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
Tags.URL.set(span, generateRequestURL(requestURL, invocation));
Tags.COMPONENT.set(span, DUBBO_COMPONENT);
Tags.SPAN_LAYER.asRPCFramework(span);
Tags.PEER_HOST.set(span, requestURL.getHost());
Tags.PEER_PORT.set(span, requestURL.getPort());
span.setPeerHost(requestURL.getHost());
span.setPort(requestURL.getPort());
if (isConsumer) {
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
......
......@@ -47,8 +47,8 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
URL url = new URL(request.url());
Span span = ContextManager.createSpan(request.url());
Tags.PEER_PORT.set(span, url.getPort());
Tags.PEER_HOST.set(span, url.getHost());
span.setPeerHost(url.getHost());
span.setPort(url.getPort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
Tags.COMPONENT.set(span, COMPONENT_NAME);
Tags.HTTP.METHOD.set(span, request.method());
......
......@@ -34,8 +34,8 @@ public class HttpClientExecuteInterceptor implements InstanceMethodsAroundInterc
HttpHost httpHost = (HttpHost) allArguments[0];
HttpRequest httpRequest = (HttpRequest) allArguments[1];
Span span = createSpan(httpRequest);
Tags.PEER_PORT.set(span, httpHost.getPort());
Tags.PEER_HOST.set(span, httpHost.getHostName());
span.setPeerHost(httpHost.getHostName());
span.setPort(httpHost.getPort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
Tags.COMPONENT.set(span, COMPONENT_NAME);
Tags.URL.set(span, generateURL(httpRequest));
......
......@@ -11,7 +11,7 @@ import java.sql.SQLException;
* {@link CallableStatementTracing} create span with the {@link Span#operationName} start with
* "JDBC/CallableStatement/"and set {@link ConnectionInfo#dbType} to the {@link Tags#COMPONENT}.
* <p>
* Notice: {@link Tags#PEERS} may be is null if database connection url don't contain multiple hosts.
* Notice: {@link Span#peerHost} may be is null if database connection url don't contain multiple hosts.
*
* @author zhangxin
*/
......@@ -29,10 +29,10 @@ public class CallableStatementTracing {
Tags.SPAN_LAYER.asDB(span);
Tags.COMPONENT.set(span, connectInfo.getDBType());
if (!StringUtil.isEmpty(connectInfo.getHosts())) {
Tags.PEERS.set(span, connectInfo.getHosts());
span.setPeers(connectInfo.getHosts());
} else {
Tags.PEER_PORT.set(span, connectInfo.getPort());
Tags.PEER_HOST.set(span, connectInfo.getHost());
span.setPeerHost(connectInfo.getHost());
span.setPort(connectInfo.getPort());
}
return exec.exe(realStatement, sql);
} catch (SQLException e) {
......
......@@ -11,7 +11,7 @@ import java.sql.SQLException;
* {@link ConnectionTracing} create span with the {@link Span#operationName} start with
* "JDBC/Connection/"and set {@link ConnectionInfo#dbType} to the {@link Tags#COMPONENT}.
* <p>
* Notice: {@link Tags#PEERS} may be is null if database connection url don't contain multiple hosts.
* Notice: {@link Span#peerHost} may be is null if database connection url don't contain multiple hosts.
*
* @author zhangxin
*/
......@@ -29,10 +29,10 @@ public class ConnectionTracing {
Tags.COMPONENT.set(span, connectInfo.getDBType());
Tags.SPAN_LAYER.asDB(span);
if (!StringUtil.isEmpty(connectInfo.getHosts())) {
Tags.PEERS.set(span, connectInfo.getHosts());
span.setPeers(connectInfo.getHosts());
} else {
Tags.PEER_PORT.set(span, connectInfo.getPort());
Tags.PEER_HOST.set(span, connectInfo.getHost());
span.setPeerHost(connectInfo.getHost());
span.setPort(connectInfo.getPort());
}
return exec.exe(realConnection, sql);
} catch (SQLException e) {
......
......@@ -11,7 +11,7 @@ import java.sql.SQLException;
* {@link PreparedStatementTracing} create span with the {@link Span#operationName} start with
* "JDBC/PreparedStatement/"and set {@link ConnectionInfo#dbType} to the {@link Tags#COMPONENT}.
* <p>
* Notice: {@link Tags#PEERS} may be is null if database connection url don't contain multiple hosts.
* Notice: {@link Span#peerHost} may be is null if database connection url don't contain multiple hosts.
*
* @author zhangxin
*/
......@@ -28,10 +28,10 @@ public class PreparedStatementTracing {
Tags.DB_STATEMENT.set(span, sql);
Tags.COMPONENT.set(span, connectInfo.getDBType());
if (!StringUtil.isEmpty(connectInfo.getHosts())) {
Tags.PEERS.set(span, connectInfo.getHosts());
span.setPeers(connectInfo.getHosts());
} else {
Tags.PEER_PORT.set(span, connectInfo.getPort());
Tags.PEER_HOST.set(span, connectInfo.getHost());
span.setPeerHost(connectInfo.getHost());
span.setPort(connectInfo.getPort());
}
Tags.SPAN_LAYER.asDB(span);
return exec.exe(realStatement, sql);
......
......@@ -11,7 +11,7 @@ import java.sql.SQLException;
* {@link StatementTracing} create span with the {@link Span#operationName} start with
* "JDBC/Statement/"and set {@link ConnectionInfo#dbType} to the {@link Tags#COMPONENT}.
* <p>
* Notice: {@link Tags#PEERS} may be is null if database connection url don't contain multiple hosts.
* Notice: {@link Span#peerHost} may be is null if database connection url don't contain multiple hosts.
*
* @author zhangxin
*/
......@@ -28,10 +28,10 @@ public class StatementTracing {
Tags.COMPONENT.set(span, connectInfo.getDBType());
Tags.SPAN_LAYER.asDB(span);
if (!StringUtil.isEmpty(connectInfo.getHosts())) {
Tags.PEERS.set(span, connectInfo.getHosts());
span.setPeers(connectInfo.getHosts());
} else {
Tags.PEER_PORT.set(span, connectInfo.getPort());
Tags.PEER_HOST.set(span, connectInfo.getHost());
span.setPeerHost(connectInfo.getHost());
span.setPort(connectInfo.getPort());
}
return exec.exe(realStatement, sql);
} catch (SQLException e) {
......
......@@ -53,10 +53,10 @@ public class JedisMethodInterceptor extends NoConcurrencyAccessObject implements
private void tagPeer(Span span, EnhancedClassInstanceContext context) {
String redisHosts = (String) context.get(KEY_OF_REDIS_HOSTS);
if (!StringUtil.isEmpty(redisHosts)) {
Tags.PEERS.set(span, (String) context.get(KEY_OF_REDIS_HOSTS));
span.setPeerHost(context.get(KEY_OF_REDIS_HOST, String.class));
} else {
Tags.PEER_HOST.set(span, (String) context.get(KEY_OF_REDIS_HOST));
Tags.PEER_PORT.set(span, (Integer) context.get(KEY_OF_REDIS_PORT));
span.setPeerHost(context.get(KEY_OF_REDIS_HOST, String.class));
span.setPort(context.get(KEY_OF_REDIS_PORT, Integer.class));
}
}
......@@ -82,10 +82,10 @@ public class JedisMethodInterceptor extends NoConcurrencyAccessObject implements
tagPeer(span, context);
Tags.SPAN_LAYER.asDB(span);
if (StringUtil.isEmpty(context.get(KEY_OF_REDIS_HOST, String.class))) {
Tags.PEERS.set(span, String.valueOf(context.get(KEY_OF_REDIS_HOSTS)));
span.setPeerHost(context.get(KEY_OF_REDIS_HOST, String.class));
} else {
Tags.PEER_HOST.set(span, context.get(KEY_OF_REDIS_HOST, String.class));
Tags.PEER_PORT.set(span, (Integer) context.get(KEY_OF_REDIS_PORT));
span.setPeerHost(context.get(KEY_OF_REDIS_HOST, String.class));
span.setPort(context.get(KEY_OF_REDIS_PORT, Integer.class));
}
if (interceptorContext.allArguments().length > 0
......
......@@ -67,8 +67,8 @@ public class MongoDBMethodInterceptor implements InstanceMethodsAroundIntercepto
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
Object ret) {
Span span = ContextManager.activeSpan();
Tags.PEER_HOST.set(span, context.get(MONGODB_HOST, String.class));
Tags.PEER_PORT.set(span, (Integer) context.get(MONGODB_PORT));
span.setPeerHost(context.get(MONGODB_HOST, String.class));
span.setPort(context.get(MONGODB_PORT, Integer.class));
ContextManager.stopSpan();
return ret;
}
......
......@@ -49,8 +49,8 @@ public class MotanConsumerInterceptor implements InstanceConstructorInterceptor,
Request request = (Request) interceptorContext.allArguments()[0];
if (url != null) {
Span span = ContextManager.createSpan(generateOperationName(url, request));
Tags.PEER_HOST.set(span, url.getHost());
Tags.PEER_PORT.set(span, url.getPort());
span.setPeerHost(url.getHost());
span.setPort(url.getPort());
Tags.COMPONENT.set(span, MOTAN_COMPONENT);
Tags.URL.set(span, url.getIdentity());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
......
......@@ -58,8 +58,8 @@ public class RealCallInterceptor implements InstanceMethodsAroundInterceptor, In
Request request = (Request)context.get(REQUEST_CONTEXT_KEY);
Span span = ContextManager.createSpan(request.url().uri().toString());
Tags.PEER_PORT.set(span, request.url().port());
Tags.PEER_HOST.set(span, request.url().host());
span.setPeerHost(request.url().host());
span.setPort(request.url().port());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
Tags.COMPONENT.set(span, COMPONENT_NAME);
Tags.HTTP.METHOD.set(span, request.method());
......
......@@ -37,8 +37,8 @@ public class ResinV3Interceptor implements InstanceMethodsAroundInterceptor {
CauchoRequest request = (CauchoRequest)args[0];
Span span = ContextManager.createSpan(request.getPageURI());
Tags.COMPONENT.set(span, RESIN_COMPONENT);
Tags.PEER_HOST.set(span, request.getServerName());
Tags.PEER_PORT.set(span, request.getServerPort());
span.setPeerHost(request.getServerName());
span.setPort(request.getServerPort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.URL.set(span, appendRequestURL(request));
Tags.SPAN_LAYER.asHttp(span);
......
......@@ -34,8 +34,8 @@ public class ResinV4Interceptor implements InstanceMethodsAroundInterceptor {
CauchoRequest request = (CauchoRequest)args[0];
Span span = ContextManager.createSpan(request.getPageURI());
Tags.COMPONENT.set(span, RESIN_COMPONENT);
Tags.PEER_HOST.set(span, request.getServerName());
Tags.PEER_PORT.set(span, request.getServerPort());
span.setPeerHost(request.getServerName());
span.setPort(request.getServerPort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.URL.set(span, appendRequestURL(request));
Tags.SPAN_LAYER.asHttp(span);
......
......@@ -45,8 +45,8 @@ public class TomcatInterceptor implements InstanceMethodsAroundInterceptor {
Span span = ContextManager.createSpan(request.getRequestURI());
Tags.COMPONENT.set(span, TOMCAT_COMPONENT);
Tags.PEER_HOST.set(span, fetchRequestPeerHost(request));
Tags.PEER_PORT.set(span, request.getRemotePort());
span.setPeerHost(fetchRequestPeerHost(request));
span.setPort(request.getRemotePort());
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.URL.set(span, request.getRequestURL().toString());
Tags.SPAN_LAYER.asHttp(span);
......
......@@ -18,7 +18,7 @@ public class DubboSpanGenerator {
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.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
span.setPeer_host("192.168.1.8");
span.setPeerHost("192.168.1.8");
span.setPort(20880);
Tags.SPAN_LAYER.asHttp(span);
}
......@@ -36,7 +36,7 @@ public class DubboSpanGenerator {
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.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
span.setPeer_host("10.21.9.35");
span.setPeerHost("10.21.9.35");
Tags.SPAN_LAYER.asHttp(span);
}
......
......@@ -16,7 +16,7 @@ public class MySQLGenerator {
Span span = ContextManager.createSpan("mysql/jdbi/statement/executeQuery");
Tags.COMPONENT.set(span, "Mysql");
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
span.setPeer_host("10.5.34.18");
span.setPeerHost("10.5.34.18");
span.setPort(30088);
Tags.DB_INSTANCE.set(span, "mysql-instance");
Tags.DB_STATEMENT.set(span, "select * from users where user_id = 1");
......
......@@ -19,7 +19,7 @@ public class TomcatSpanGenerator {
Tags.COMPONENT.set(webSpan, "Tomcat");
Tags.URL.set(webSpan, "http://10.21.9.35/web/serviceA");
Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER);
webSpan.setPeer_host("10.21.9.35");
webSpan.setPeerHost("10.21.9.35");
webSpan.setPort(80);
Tags.SPAN_LAYER.asHttp(webSpan);
}
......@@ -41,7 +41,7 @@ public class TomcatSpanGenerator {
Tags.COMPONENT.set(webSpan, "Tomcat");
Tags.URL.set(webSpan, "http://10.21.9.35/web/unknown");
Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER);
webSpan.setPeer_host("10.21.9.35");
webSpan.setPeerHost("10.21.9.35");
webSpan.setPort(80);
Tags.SPAN_LAYER.asHttp(webSpan);
}
......@@ -64,7 +64,7 @@ public class TomcatSpanGenerator {
Tags.COMPONENT.set(webSpan, "Tomcat");
Tags.URL.set(webSpan, "http://10.21.9.35/web/error/service");
Tags.SPAN_KIND.set(webSpan, Tags.SPAN_KIND_SERVER);
webSpan.setPeer_host("10.21.9.35");
webSpan.setPeerHost("10.21.9.35");
webSpan.setPort(80);
Tags.SPAN_LAYER.asHttp(webSpan);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册