From cf3f0af6f4a88e5ded93ad6a42fd902f60f5242e Mon Sep 17 00:00:00 2001 From: Andre Kurait Date: Tue, 30 Apr 2024 14:41:28 -0500 Subject: [PATCH] Increase default MAX_PAYLOAD_BYTES_TO_PRINT to 100MiB Signed-off-by: Andre Kurait --- .../migrations/replay/AddCompressionEncodingTest.java | 2 +- .../org/opensearch/migrations/replay/HttpByteBufFormatter.java | 2 +- .../opensearch/migrations/replay/HttpMessageAndTimestamp.java | 2 +- .../src/main/java/org/opensearch/migrations/replay/Utils.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TrafficCapture/replayerPlugins/jsonMessageTransformers/jsonJoltMessageTransformerProvider/src/test/java/org/opensearch/migrations/replay/AddCompressionEncodingTest.java b/TrafficCapture/replayerPlugins/jsonMessageTransformers/jsonJoltMessageTransformerProvider/src/test/java/org/opensearch/migrations/replay/AddCompressionEncodingTest.java index 3eac3e974..a8aa4fe52 100644 --- a/TrafficCapture/replayerPlugins/jsonMessageTransformers/jsonJoltMessageTransformerProvider/src/test/java/org/opensearch/migrations/replay/AddCompressionEncodingTest.java +++ b/TrafficCapture/replayerPlugins/jsonMessageTransformers/jsonJoltMessageTransformerProvider/src/test/java/org/opensearch/migrations/replay/AddCompressionEncodingTest.java @@ -67,7 +67,7 @@ public void addingCompressionRequestHeaderCompressesPayload() throws ExecutionEx EmbeddedChannel channel = new EmbeddedChannel( new HttpServerCodec(), - new HttpObjectAggregator(Utils.MAX_PAYLOAD_SIZE_TO_PRINT) // Set max content length if needed + new HttpObjectAggregator(Utils.MAX_PAYLOAD_BYTES_TO_PRINT) // Set max content length if needed ); channel.writeInbound(Unpooled.wrappedBuffer(testPacketCapture.getBytesCaptured())); diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpByteBufFormatter.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpByteBufFormatter.java index 272ea38e6..8381cbd83 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpByteBufFormatter.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpByteBufFormatter.java @@ -146,7 +146,7 @@ public static HttpMessage parseHttpMessageFromBufs(HttpMessageType msgType, Stre EmbeddedChannel channel = new EmbeddedChannel( msgType == HttpMessageType.REQUEST ? new HttpServerCodec() : new HttpClientCodec(), new HttpContentDecompressor(), - new HttpObjectAggregator(Utils.MAX_PAYLOAD_SIZE_TO_PRINT) // Set max content length if needed + new HttpObjectAggregator(Utils.MAX_PAYLOAD_BYTES_TO_PRINT) // Set max content length if needed ); try { byteBufStream.forEachOrdered(b -> channel.writeInbound(b.retainedDuplicate())); diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpMessageAndTimestamp.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpMessageAndTimestamp.java index 0529b2b27..5eff0dfaf 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpMessageAndTimestamp.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/HttpMessageAndTimestamp.java @@ -68,7 +68,7 @@ public String format(Optional messageTypeO try (var bufStream = NettyUtils.createRefCntNeutralCloseableByteBufStream(packetBytes)) { var packetBytesAsStr = messageTypeOp.map(mt-> HttpByteBufFormatter.httpPacketBytesToString(mt, packetBytes, HttpByteBufFormatter.LF_LINE_DELIMITER)) - .orElseGet(()-> HttpByteBufFormatter.httpPacketBufsToString(bufStream, Utils.MAX_PAYLOAD_SIZE_TO_PRINT)); + .orElseGet(()-> HttpByteBufFormatter.httpPacketBufsToString(bufStream, Utils.MAX_PAYLOAD_BYTES_TO_PRINT)); final StringBuilder sb = new StringBuilder("HttpMessageAndTimestamp{"); sb.append("firstPacketTimestamp=").append(firstPacketTimestamp); sb.append(", lastPacketTimestamp=").append(lastPacketTimestamp); diff --git a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/Utils.java b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/Utils.java index 9a4a987f2..93196c157 100644 --- a/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/Utils.java +++ b/TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/Utils.java @@ -21,7 +21,7 @@ @Slf4j public class Utils { public static final int MAX_BYTES_SHOWN_FOR_TO_STRING = 128; - public static final int MAX_PAYLOAD_SIZE_TO_PRINT = 1024 * 1024; // 1MB + public static final int MAX_PAYLOAD_BYTES_TO_PRINT = 100 * 1024 * 1024; // 100MiB based on https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#network-limits public static Instant setIfLater(AtomicReference referenceValue, Instant pointInTime) { return referenceValue.updateAndGet(existingInstant -> existingInstant.isBefore(pointInTime) ?