Skip to content

[Dynamic Instrumentation] Change the way we are using the gzip stream in SymDB #6562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions tracer/src/Datadog.Trace/Debugger/Upload/SymbolUploadApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,25 @@ public override async Task<bool> SendBatchAsync(ArraySegment<byte> symbols)

MultipartFormItem symbolsItem;

if (_enableCompression)
if (!this._enableCompression)
{
symbolsItem = new MultipartFormItem("file", MimeTypes.Json, "file.json", symbols);
}
else
{
using var memoryStream = new MemoryStream();
#if NETFRAMEWORK
using var gzipStream = new Vendors.ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memoryStream);
await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false);
await gzipStream.FlushAsync().ConfigureAwait(false);
using (var gzipStream = new Vendors.ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memoryStream))
#else
using var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress);
await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false);
await gzipStream.FlushAsync().ConfigureAwait(false);
using (var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress))
#endif
{
await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false);
await gzipStream.FlushAsync().ConfigureAwait(false);
}

symbolsItem = new MultipartFormItem("file", MimeTypes.Gzip, "file.gz", new ArraySegment<byte>(memoryStream.ToArray()));
}
else
{
symbolsItem = new MultipartFormItem("file", MimeTypes.Json, "file.json", symbols);
}

var items = new[] { symbolsItem, new MultipartFormItem("event", MimeTypes.Json, "event.json", _eventMetadata) };

Expand Down
Loading