Search in sources :

Example 1 with MatcherGroup

use of com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup 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();
}
Also used : MatcherGroup(com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.ServerInstanceList) List(java.util.List) LinkInfo(com.navercorp.pinpoint.web.applicationmap.link.LinkInfo) Map(java.util.Map)

Example 2 with MatcherGroup

use of com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup in project pinpoint by naver.

the class AgentInfoSerializer method serialize.

@Override
public void serialize(AgentInfo agentInfo, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
    jgen.writeStartObject();
    jgen.writeStringField("applicationName", agentInfo.getApplicationName());
    jgen.writeStringField("agentId", agentInfo.getAgentId());
    jgen.writeNumberField("startTimestamp", agentInfo.getStartTimestamp());
    jgen.writeStringField("hostName", agentInfo.getHostName());
    jgen.writeStringField("ip", agentInfo.getIp());
    jgen.writeStringField("ports", agentInfo.getPorts());
    final ServiceType serviceType = serviceTypeRegistryService.findServiceType(agentInfo.getServiceTypeCode());
    jgen.writeStringField("serviceType", serviceType.getDesc());
    jgen.writeNumberField("pid", agentInfo.getPid());
    jgen.writeStringField("vmVersion", agentInfo.getVmVersion());
    jgen.writeStringField("agentVersion", agentInfo.getAgentVersion());
    jgen.writeObjectField("serverMetaData", agentInfo.getServerMetaData());
    jgen.writeObjectField("jvmInfo", agentInfo.getJvmInfo());
    AgentStatus status = agentInfo.getStatus();
    if (status != null) {
        jgen.writeObjectField("status", status);
    }
    jgen.writeNumberField("initialStartTimestamp", agentInfo.getInitialStartTimestamp());
    if (matcherGroupList != null) {
        jgen.writeFieldName("linkList");
        jgen.writeStartArray();
        for (MatcherGroup matcherGroup : matcherGroupList) {
            if (matcherGroup.ismatchingType(agentInfo)) {
                LinkInfo linkInfo = matcherGroup.makeLinkInfo(agentInfo);
                jgen.writeStartObject();
                jgen.writeStringField("linkName", linkInfo.getLinkName());
                jgen.writeStringField("linkURL", linkInfo.getLinkUrl());
                jgen.writeStringField("linkType", linkInfo.getLinktype());
                jgen.writeEndObject();
            }
        }
        jgen.writeEndArray();
    }
    jgen.writeEndObject();
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) MatcherGroup(com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup) LinkInfo(com.navercorp.pinpoint.web.applicationmap.link.LinkInfo)

Aggregations

LinkInfo (com.navercorp.pinpoint.web.applicationmap.link.LinkInfo)2 MatcherGroup (com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup)2 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 ServerInstanceList (com.navercorp.pinpoint.web.applicationmap.ServerInstanceList)1 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)1 List (java.util.List)1 Map (java.util.Map)1