Skip to content

Commit 7972e87

Browse files
committed
* log-exporter: export action and event in parquet format
Signed-off-by: neo <[email protected]>
1 parent 167d454 commit 7972e87

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

ext/log-exporter/src/main/java/core/log/domain/ActionLogSchema.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var record = new GenericData.Record(schema);
5959
if (stat.readEntries != null) perfStats.put(key + ".read_entries", (long) stat.readEntries);
6060
if (stat.writeEntries != null) perfStats.put(key + ".write_entries", (long) stat.writeEntries);
6161
}
62-
record.put("perf_stats", message.performanceStats);
62+
record.put("perf_stats", perfStats);
6363
return record;
6464
}
6565
}

ext/log-exporter/src/test/java/core/log/kafka/ActionLogMessageHandlerTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import core.framework.inject.Inject;
44
import core.framework.kafka.Message;
55
import core.framework.log.message.ActionLogMessage;
6+
import core.framework.log.message.PerformanceStatMessage;
67
import core.framework.util.Files;
78
import core.log.IntegrationTest;
89
import core.log.domain.ActionLogSchema;
@@ -20,9 +21,9 @@
2021
* @author neo
2122
*/
2223
class ActionLogMessageHandlerTest extends IntegrationTest {
23-
private ActionLogMessageHandler handler;
2424
@Inject
2525
ActionLogSchema schema;
26+
private ActionLogMessageHandler handler;
2627

2728
@BeforeEach
2829
void createActionLogMessageHandler() {
@@ -48,9 +49,19 @@ void handle() throws IOException {
4849
message.host = "host";
4950
message.elapsed = 1000L;
5051
message.context = Map.of("key", List.of("value1", "value2"));
51-
message.performanceStats = Map.of();
52+
message.performanceStats = Map.of("kafka", perfStats(1, 1000L, 10, 5),
53+
"http", perfStats(1, 2000L, null, null));
5254
message.traceLog = "trace";
5355
handler.handle(List.of(new Message<>("key", message)));
5456
handler.handle(List.of(new Message<>("key", message)));
5557
}
58+
59+
private PerformanceStatMessage perfStats(int count, long totalElapsed, Integer readEntries, Integer writeEntries) {
60+
final PerformanceStatMessage stats = new PerformanceStatMessage();
61+
stats.count = count;
62+
stats.totalElapsed = totalElapsed;
63+
stats.readEntries = readEntries;
64+
stats.writeEntries = writeEntries;
65+
return stats;
66+
}
5667
}

0 commit comments

Comments
 (0)