提交 5e2204e2 编写于 作者: P pengys5

Add some property into tag array.

上级 7ac93aff
......@@ -6,12 +6,14 @@ import java.util.List;
import org.skywalking.apm.collector.core.util.Const;
import org.skywalking.apm.collector.core.util.StringUtils;
import org.skywalking.apm.collector.storage.dao.DAOContainer;
import org.skywalking.apm.collector.ui.cache.ApplicationCache;
import org.skywalking.apm.collector.ui.cache.ServiceNameCache;
import org.skywalking.apm.collector.ui.dao.ISegmentDAO;
import org.skywalking.apm.network.proto.KeyWithStringValue;
import org.skywalking.apm.network.proto.LogMessage;
import org.skywalking.apm.network.proto.SpanObject;
import org.skywalking.apm.network.proto.TraceSegmentObject;
import org.skywalking.apm.network.trace.component.ComponentsDefine;
/**
* @author pengys5
......@@ -31,8 +33,6 @@ public class SpanService {
String serviceName = ServiceNameCache.get(spanObject.getOperationNameId());
if (StringUtils.isNotEmpty(serviceName)) {
operationName = serviceName.split(Const.ID_SPLIT)[1];
} else {
operationName = Const.EMPTY_STRING;
}
}
spanJson.addProperty("operationName", operationName);
......@@ -58,12 +58,42 @@ public class SpanService {
spanJson.add("logMessage", logsArray);
JsonArray tagsArray = new JsonArray();
JsonObject spanTypeJson = new JsonObject();
spanTypeJson.addProperty("key", "span type");
spanTypeJson.addProperty("value", spanObject.getSpanType().name());
tagsArray.add(spanTypeJson);
JsonObject componentJson = new JsonObject();
componentJson.addProperty("key", "component");
if (spanObject.getComponentId() == 0) {
componentJson.addProperty("value", spanObject.getComponent());
} else {
componentJson.addProperty("value", ComponentsDefine.getInstance().getComponentName(spanObject.getComponentId()));
}
tagsArray.add(componentJson);
JsonObject peerJson = new JsonObject();
peerJson.addProperty("key", "peer");
if (spanObject.getPeerId() == 0) {
peerJson.addProperty("value", spanObject.getPeer());
} else {
peerJson.addProperty("value", ApplicationCache.getForUI(spanObject.getPeerId()));
}
tagsArray.add(peerJson);
for (KeyWithStringValue tagValue : spanObject.getTagsList()) {
JsonObject tagJson = new JsonObject();
tagJson.addProperty("key", tagValue.getKey());
tagJson.addProperty("value", tagValue.getValue());
tagsArray.add(tagJson);
}
JsonObject isErrorJson = new JsonObject();
isErrorJson.addProperty("key", "is error");
isErrorJson.addProperty("value", spanObject.getIsError());
tagsArray.add(isErrorJson);
spanJson.add("tags", tagsArray);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册