From 53aa5e858a14649deba5e31053d17d6b8ae22b94 Mon Sep 17 00:00:00 2001 From: Dmitry Lyubin Date: Thu, 21 Aug 2025 16:42:59 +0300 Subject: [PATCH] enable statistics payload compression (cherry picked from commit 10b2bc03175e2d75f478eaf91c2554ee5ed662e4) (cherry picked from commit d7a05b205c72626f9b25347c412de8e8a72853d6) --- .../eventLog/connection/EventLogStatisticsService.java | 2 +- .../eventLog/connection/request/StatsRequestBuilder.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogStatisticsService.java b/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogStatisticsService.java index 71f70db0d147..00bb73e4a697 100644 --- a/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogStatisticsService.java +++ b/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogStatisticsService.java @@ -123,7 +123,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()); diff --git a/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/request/StatsRequestBuilder.java b/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/request/StatsRequestBuilder.java index da66d4197be7..b69567709fce 100644 --- a/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/request/StatsRequestBuilder.java +++ b/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/request/StatsRequestBuilder.java @@ -176,10 +176,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();