Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase default MAX_PAYLOAD_BYTES_TO_PRINT to 100MiB #622

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public String format(Optional<HttpByteBufFormatter.HttpMessageType> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Instant> referenceValue, Instant pointInTime) {
return referenceValue.updateAndGet(existingInstant -> existingInstant.isBefore(pointInTime) ?
Expand Down