use of com.navercorp.pinpoint.web.applicationmap.ServerInstanceList in project pinpoint by naver.
the class LinkSerializer method writeAgentId.
private void writeAgentId(String fieldName, Node node, JsonGenerator jgen) throws IOException {
if (node.getServiceType().isWas()) {
jgen.writeFieldName(fieldName);
jgen.writeStartArray();
ServerInstanceList serverInstanceList = node.getServerInstanceList();
if (serverInstanceList != null) {
for (String agentId : serverInstanceList.getAgentIdList()) {
jgen.writeObject(agentId);
}
}
jgen.writeEndArray();
}
}
use of com.navercorp.pinpoint.web.applicationmap.ServerInstanceList in project pinpoint by naver.
the class ServerInstanceListSerializer method serialize.
@Override
public void serialize(ServerInstanceList serverInstanceList, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeStartObject();
Map<String, List<ServerInstance>> map = serverInstanceList.getServerInstanceList();
for (Map.Entry<String, List<ServerInstance>> entry : map.entrySet()) {
jgen.writeFieldName(entry.getKey());
jgen.writeStartObject();
jgen.writeStringField("name", entry.getKey());
jgen.writeStringField("status", null);
if (matcherGroupList != null) {
jgen.writeFieldName("linkList");
jgen.writeStartArray();
for (MatcherGroup matcherGroup : matcherGroupList) {
if (matcherGroup.ismatchingType(entry.getValue().get(0))) {
LinkInfo linkInfo = matcherGroup.makeLinkInfo(entry.getValue().get(0));
jgen.writeStartObject();
jgen.writeStringField("linkName", linkInfo.getLinkName());
jgen.writeStringField("linkURL", linkInfo.getLinkUrl());
jgen.writeStringField("linkType", linkInfo.getLinktype());
jgen.writeEndObject();
}
}
jgen.writeEndArray();
}
jgen.writeFieldName("instanceList");
writeInstanceList(jgen, entry.getValue());
jgen.writeEndObject();
}
jgen.writeEndObject();
}
use of com.navercorp.pinpoint.web.applicationmap.ServerInstanceList in project pinpoint by naver.
the class NodeSerializer method serialize.
@Override
public void serialize(Node node, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeStartObject();
// jgen.writeStringField("id", node.getNodeName());
// necessary for go.js
jgen.writeStringField("key", node.getNodeName());
// for go.js
jgen.writeStringField("applicationName", node.getApplicationTextName());
// necessary for go.js
jgen.writeStringField("category", node.getServiceType().toString());
jgen.writeStringField("serviceType", node.getServiceType().toString());
final ServiceType serviceType = node.getApplication().getServiceType();
// if (serviceType.isUser()) {
// jgen.writeStringField("fig", "Ellipse");
// } else if(serviceType.isWas()) {
// jgen.writeStringField("fig", "RoundedRectangle");
// } else {
// jgen.writeStringField("fig", "Rectangle");
// }
jgen.writeStringField("serviceTypeCode", Short.toString(serviceType.getCode()));
// jgen.writeStringField("terminal", Boolean.toString(serviceType.isTerminal()));
// for go.js
jgen.writeBooleanField("isWas", serviceType.isWas());
jgen.writeBooleanField("isQueue", serviceType.isQueue());
jgen.writeBooleanField("isAuthorized", node.isAuthorized());
writeHistogram(jgen, node);
if (node.getServiceType().isUnknown()) {
writeEmptyObject(jgen, "serverList");
jgen.writeNumberField("instanceCount", 0);
} else {
final ServerInstanceList serverInstanceList = node.getServerInstanceList();
if (serverInstanceList != null) {
jgen.writeObjectField("serverList", serverInstanceList);
jgen.writeNumberField("instanceCount", serverInstanceList.getInstanceCount());
} else {
writeEmptyObject(jgen, "serverList");
jgen.writeNumberField("instanceCount", 0);
}
}
jgen.writeEndObject();
}
use of com.navercorp.pinpoint.web.applicationmap.ServerInstanceList in project pinpoint by naver.
the class ServerInstanceListSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
ObjectMapper mapper = createMapper();
AgentInfo agentInfo = ServerInstanceListTest.createAgentInfo("agentId1", "testHost");
Set<AgentInfo> agentInfoSet = new HashSet<>();
agentInfoSet.add(agentInfo);
ServerBuilder builder = new ServerBuilder();
builder.addAgentInfo(agentInfoSet);
ServerInstanceList serverInstanceList = builder.build();
ObjectWriter objectWriter = mapper.writerWithDefaultPrettyPrinter();
String json = objectWriter.writeValueAsString(serverInstanceList);
logger.debug(json);
}
Aggregations