Skip to content

Commit 7405a75

Browse files
committed
Add support for Zstd
1 parent 2daafac commit 7405a75

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

profiler/test/Datadog.Profiler.IntegrationTests/Datadog.Profiler.IntegrationTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8787
<PrivateAssets>all</PrivateAssets>
8888
</PackageReference>
89+
<PackageReference Include="ZstdSharp.Port" Version="0.8.6" />
8990
</ItemGroup>
9091
<ItemGroup Condition=" $(DD_LOGGER_ENABLED) != 'false' ">
9192
<PackageReference Include="DatadogTestLogger" Version="0.0.38" ExcludeAssets="compile" />

profiler/test/Datadog.Profiler.IntegrationTests/Helpers/SamplesHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
using K4os.Compression.LZ4.Streams;
1212
using Perftools.Profiles;
1313
using Xunit;
14+
using ZstdSharp;
1415

1516
namespace Datadog.Profiler.IntegrationTests.Helpers
1617
{
1718
public static class SamplesHelper
1819
{
1920
private static readonly byte[] Lz4MagicNumber = BitConverter.GetBytes(0x184D2204);
21+
private static readonly byte[] ZstdMagicNumber = BitConverter.GetBytes(0xFD2FB528);
2022

2123
public static int GetSamplesCount(string directory)
2224
{
@@ -213,6 +215,10 @@ private static Stream GetStream(string filename)
213215
{
214216
return LZ4Stream.Decode(s);
215217
}
218+
else if (ZstdMagicNumber.SequenceEqual(buffer))
219+
{
220+
return new DecompressionStream(s);
221+
}
216222
else
217223
{
218224
return s;

0 commit comments

Comments
 (0)