weiqingy commented on code in PR #609:
URL: https://github.com/apache/flink-agents/pull/609#discussion_r3094868967
##########
runtime/src/main/java/org/apache/flink/agents/runtime/eventlog/EventLogRecord.java:
##########
@@ -31,23 +33,82 @@
*
* <p>The class uses custom JSON serialization/deserialization to handle
polymorphic Event types by
* leveraging the eventType information stored in the EventContext.
+ *
+ * <p>Each record carries a {@link EventLogLevel} that controls truncation
behavior during
+ * serialization, and a convenience copy of the event type string from the
context.
*/
@JsonSerialize(using = EventLogRecordJsonSerializer.class)
@JsonDeserialize(using = EventLogRecordJsonDeserializer.class)
public class EventLogRecord {
private final EventContext context;
private final Event event;
+ private final EventLogLevel logLevel;
+ private final String eventType;
+ private final transient JsonTruncator truncator;
+ private final transient Counter truncatedEventsCounter;
Review Comment:
Added `@Nullable` on both fields.
Regarding removing them from `EventLogRecord` — I agree they are
serialization plumbing rather than content. However, Jackson's custom
serializer (`EventLogRecordJsonSerializer`) receives only the record object via
`serialize(EventLogRecord record, ...)`. Since the `ObjectMapper` is
shared/static, there's no clean way to pass the truncator and counter to the
serializer except through the record itself. The `transient` + `@Nullable`
markers signal that these are not part of the logical content. Happy to explore
alternatives if you have a preferred pattern in mind.
--
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]