weiqingy commented on code in PR #609:
URL: https://github.com/apache/flink-agents/pull/609#discussion_r3094860436
##########
runtime/src/main/java/org/apache/flink/agents/runtime/eventlog/EventLogRecordJsonSerializer.java:
##########
@@ -67,15 +70,37 @@ public void serialize(EventLogRecord record, JsonGenerator
gen, SerializerProvid
gen.writeStartObject();
gen.writeStringField("timestamp", record.getContext().getTimestamp());
+ gen.writeStringField(
+ "logLevel", record.getLogLevel() != null ?
record.getLogLevel().name() : "VERBOSE");
+ // For PythonEvent, use the Python module path as the top-level
eventType
+ // (consistent with the eventType inside the event object)
+ String topLevelEventType = record.getContext().getEventType();
+ if (record.getEvent() instanceof PythonEvent) {
+ String pythonType = ((PythonEvent)
record.getEvent()).getEventType();
+ if (pythonType != null) {
+ topLevelEventType = pythonType;
+ }
+ }
Review Comment:
Good catch. Extracted `EventUtil.resolveEventType(Event, EventContext)` and
replaced the duplicated logic in both `FileEventLogger.append()` and
`EventLogRecordJsonSerializer.serialize()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]