pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/kosedogukan/dd-trace-java/commit/38ccc57998d33f416a49e65e2c6b6f1a0be2d4dc

Add zstd scenario to profile uploading tests (#8869) · kosedogukan/dd-trace-java@38ccc57 · GitHub
Skip to content

Commit 38ccc57

Browse files
author
Matt
authored
Add zstd scenario to profile uploading tests (DataDog#8869)
1 parent 7d25eca commit 38ccc57

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dd-java-agent/agent-profiling/profiling-uploader/src/test/java/com/datadog/profiling/uploader/ProfileUploaderTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import datadog.trace.relocate.api.IOLogger;
5353
import datadog.trace.util.PidHelper;
5454
import delight.fileupload.FileUpload;
55+
import io.airlift.compress.zstd.ZstdInputStream;
5556
import java.io.BufferedInputStream;
5657
import java.io.ByteArrayInputStream;
5758
import java.io.ByteArrayOutputStream;
@@ -337,7 +338,7 @@ public void testZippedInput() throws Exception {
337338
}
338339

339340
@ParameterizedTest
340-
@ValueSource(strings = {"on", "lz4", "gzip", "off", "invalid"})
341+
@ValueSource(strings = {"on", "lz4", "gzip", "zstd", "off", "invalid"})
341342
public void testCompression(final String compression) throws Exception {
342343
when(config.getApiKey()).thenReturn(null);
343344
when(config.getProfilingUploadCompression()).thenReturn(compression);
@@ -372,6 +373,8 @@ public void testCompression(final String compression) throws Exception {
372373
byte[] uploadedBytes = rawJfr.get();
373374
if (compression.equals("gzip")) {
374375
uploadedBytes = unGzip(uploadedBytes);
376+
} else if (compression.equals("zstd")) {
377+
uploadedBytes = unZstd(uploadedBytes);
375378
} else if (compression.equals("on")
376379
|| compression.equals("lz4")
377380
|| compression.equals("invalid")) {
@@ -895,6 +898,13 @@ private static byte[] unLz4(final byte[] compressed) throws IOException {
895898
return result.toByteArray();
896899
}
897900

901+
private static byte[] unZstd(final byte[] compressed) throws IOException {
902+
final InputStream stream = new ZstdInputStream(new ByteArrayInputStream(compressed));
903+
final ByteArrayOutputStream result = new ByteArrayOutputStream();
904+
ByteStreams.copy(stream, result);
905+
return result.toByteArray();
906+
}
907+
898908
private void uploadAndWait(final RecordingType recordingType, final RecordingData data)
899909
throws InterruptedException {
900910
final CountDownLatch latch = new CountDownLatch(1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy