Make lz4 default compression
Also do some renaming in compression settings
MODIFY
dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/CompressionType.java
dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/CompressionType.java
@@ -9,9 +9,9 @@ enum CompressionType {
/** Default compression */
ON,
/** Lower compression ratio with less CPU overhead * */
- LOW,
+ LZ4,
/** Better compression ratio for the price of higher CPU usage * */
- MEDIUM;
+ GZIP;
static CompressionType of(String type) {
if (type == null) {
@@ -23,10 +23,10 @@ enum CompressionType {
return OFF;
case "on":
return ON;
- case "low":
- return LOW;
- case "medium":
- return MEDIUM;
+ case "lz4":
+ return LZ4;
+ case "gzip":
+ return GZIP;
default:
log.warn("Unrecognizable compression type: {}. Defaulting to 'on'.", type);
return ON;

MODIFY
dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/RecordingUploader.java
dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/RecordingUploader.java
@@ -244,21 +244,21 @@ public final class RecordingUploader {
// currently only gzip and off are supported
// this needs to be updated once more compression types are added
switch (type) {
- case ON:
- case MEDIUM:
- default:
+ case GZIP:
{
compression = (is, expectedSize) -> StreamUtils.gzipStream(is, expectedSize, consumer);
break;
}
- case LOW:
+ case OFF:
{
- compression = (is, expectedSize) -> StreamUtils.lz4Stream(is, expectedSize, consumer);
+ compression = (is, expectedSize) -> StreamUtils.readStream(is, expectedSize, consumer);
break;
}
- case OFF:
+ case ON:
+ case LZ4:
+ default:
{
- compression = (is, expectedSize) -> StreamUtils.readStream(is, expectedSize, consumer);
+ compression = (is, expectedSize) -> StreamUtils.lz4Stream(is, expectedSize, consumer);
break;
}
}

MODIFY
dd-java-agent/agent-profiling/profiling-uploader/src/test/java/com/datadog/profiling/uploader/RecordingUploaderTest.java
dd-java-agent/agent-profiling/profiling-uploader/src/test/java/com/datadog/profiling/uploader/RecordingUploaderTest.java
@@ -139,7 +139,7 @@ public class RecordingUploaderTest {
}
@ParameterizedTest
- @ValueSource(strings = {"on", "low", "medium", "off", "invalid"})
+ @ValueSource(strings = {"on", "lz4", "gzip", "off", "invalid"})
public void testRequestParameters(final String compression)
throws IOException, InterruptedException {
when(config.getProfilingUploadCompression()).thenReturn(compression);
@@ -185,9 +185,11 @@ public class RecordingUploaderTest {
byte[] uploadedBytes =
(byte[]) Iterables.getFirst(parameters.get(RecordingUploader.DATA_PARAM), new byte[] {});
- if (compression.equals("on") || compression.equals("medium") || compression.equals("invalid")) {
+ if (compression.equals("gzip")) {
uploadedBytes = unGzip(uploadedBytes);
- } else if (compression.equals("low")) {
+ } else if (compression.equals("on")
+ || compression.equals("lz4")
+ || compression.equals("invalid")) {
uploadedBytes = unLz4(uploadedBytes);
}
assertArrayEquals(expectedBytes, uploadedBytes);

MODIFY
dd-smoke-tests/profiling-integration-tests/src/test/groovy/datadog/smoketest/ProfilingIntegrationContinuousProfilesTest.groovy
dd-smoke-tests/profiling-integration-tests/src/test/groovy/datadog/smoketest/ProfilingIntegrationContinuousProfilesTest.groovy
@@ -2,6 +2,7 @@ package datadog.smoketest
import com.datadog.profiling.testing.ProfilingTestUtils
import com.google.common.collect.Multimap
+import net.jpountz.lz4.LZ4FrameInputStream
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import okhttp3.mockwebserver.RecordedRequest
@@ -11,7 +12,6 @@ import org.openjdk.jmc.flightrecorder.JfrLoaderToolkit
import java.time.Instant
import java.util.concurrent.TimeUnit
-import java.util.zip.GZIPInputStream
class ProfilingIntegrationContinuousProfilesTest extends AbstractSmokeTest {
@@ -97,7 +97,7 @@ class ProfilingIntegrationContinuousProfilesTest extends AbstractSmokeTest {
firstRequestParameters.get("chunk-data").get(0) != null
- IItemCollection events = JfrLoaderToolkit.loadEvents(new GZIPInputStream(new ByteArrayInputStream(secondRequestParameters.get("chunk-data").get(0))))
+ IItemCollection events = JfrLoaderToolkit.loadEvents(new LZ4FrameInputStream(new ByteArrayInputStream(secondRequestParameters.get("chunk-data").get(0))))
IItemCollection scopeEvents = events.apply(ItemFilters.type("datadog.Scope"))
scopeEvents.size() > 0

Make lz4 default compression

Also do some renaming in compression settings