enable statistics payload compression

(cherry picked from commit 10b2bc0317)
(cherry picked from commit d7a05b205c)
(cherry picked from commit 53aa5e858a)
This commit is contained in:
Dmitry Lyubin
2025-08-21 16:42:59 +03:00
committed by Nikita Iarychenko
parent 995e7c80c4
commit 88aa42122f
2 changed files with 3 additions and 5 deletions

View File

@@ -130,7 +130,7 @@ public class EventLogStatisticsService implements StatisticsService {
try {
logger.info("Statistics. Starting sending " + file.getName() + " to " + serviceUrl);
StatsHttpRequests.post(serviceUrl, connectionSettings).
withBody(LogEventSerializer.INSTANCE.toString(recordRequest), "application/json", StandardCharsets.UTF_8).
withBody(LogEventSerializer.INSTANCE.toString(recordRequest), "application/octet-stream", StandardCharsets.UTF_8).
succeed((r, code) -> {
toRemove.add(file);
decorator.onSucceed(recordRequest, loadAndLogResponse(logger, r, file), file.getAbsolutePath());

View File

@@ -186,10 +186,8 @@ public class StatsRequestBuilder {
}
builder.setHeader("Chunked", Boolean.toString(false));
builder.setHeader("Content-Type", String.format(Locale.ENGLISH, "%s; charset=%s", myContentType, myCharset));
// temporarily disable compression due to YC issues
//builder.setHeader("Content-Encoding", "gzip");
//builder.POST(HttpRequest.BodyPublishers.ofByteArray(getCompressedContent()));
builder.POST(HttpRequest.BodyPublishers.ofString(myContent, myCharset));
builder.setHeader("Content-Encoding", "gzip");
builder.POST(HttpRequest.BodyPublishers.ofByteArray(getCompressedContent()));
}
else if ("GET".equals(myMethod)) {
builder.GET();