alnzng commented on code in PR #103: URL: https://github.com/apache/flink-agents/pull/103#discussion_r2267719340
########## api/src/main/java/org/apache/flink/agents/api/logger/EventLogger.java: ########## @@ -0,0 +1,116 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.agents.api.logger; + +import org.apache.flink.agents.api.Event; +import org.apache.flink.agents.api.EventContext; +import org.apache.flink.agents.api.EventFilter; + +/** + * Interface for logging action events in the Flink Agents framework. + * + * <p>EventLogger provides a unified interface for capturing, filtering, and persisting events as + * they flow through the agent execution pipeline. Implementations can target different storage + * backends such as Flink state, external databases, or file systems. + */ +public interface EventLogger extends AutoCloseable { + + /** + * Initialize the event logger. + * + * <p>This method is called once during setup to prepare the logging infrastructure. + * Implementations should establish connections, initialize state, and prepare for logging + * operations. + * + * @throws Exception if initialization fails + */ + void open() throws Exception; + + /** + * Appends an event along with its associated context to the logger. + * + * <p>This method is invoked for each event that passes the configured filter. Implementations + * should perform the append operation efficiently, as it may be called frequently during event + * processing. + * + * @param context metadata and other contextual information associated with the event + * @param event the event to be logged + * @throws Exception if the append operation fails + */ + void append(EventContext context, Event event) throws Exception; + + /** + * Close the event logger and release resources. + * + * <p>This method is called during cleanup. Implementations should flush any remaining records + * and release all resources. + * + * @throws Exception if closing fails + */ + @Override + void close() throws Exception; + + /** + * Unwraps the EventLogger if it is wrapped by another logger or filter. + * + * <p>This method can be overridden by implementations that wrap other loggers or filters to + * return the underlying logger. + * + * @return the underlying EventLogger instance + */ + default EventLogger unwrap() { + return this; + } Review Comment: Explained this in below comment. TLDR; this is just for FlinkStateEventLogger, we can remove it since we are going to remove FlinkStateEventLogger. -- 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]
