@Override
    public void serialize(AgentEvent agentEvent, JsonGenerator jgen, SerializerProvider serializers) throws IOException {
        jgen.writeStartObject();

        if (agentEvent.getAgentId() != null) {
            jgen.writeStringField("agentId", agentEvent.getAgentId());
        }

        jgen.writeNumberField("startTimestamp", agentEvent.getStartTimestamp());
        jgen.writeNumberField("eventTimestamp", agentEvent.getEventTimestamp());
        jgen.writeNumberField("eventTypeCode", agentEvent.getEventTypeCode());

        if (agentEvent.getEventTypeDesc() != null) {
            jgen.writeStringField("eventTypeDesc", agentEvent.getEventTypeDesc());
        }

        jgen.writeBooleanField("hasEventMessage", agentEvent.hasEventMessage());

        final Object eventMessage = agentEvent.getEventMessage();
        if (eventMessage != null) {
            if (eventMessage instanceof DeadlockBo deadlock) {
                final String deadLockEvent = deadLockEvent(deadlock);
                jgen.writeObjectField("eventMessage", deadLockEvent);
            } else {
                jgen.writeObjectField("eventMessage", eventMessage);
            }
        }

        jgen.writeEndObject();
    }
@author Taejin Koo
@author jaehong.kim - Add DeadlockBo logic
web/src/main/java/com/navercorp/pinpoint/web/view/AgentEventSerializer.java