Skip to content

Commit

Permalink
DEBUG-2315 Check specific path for diagnostics upload
Browse files Browse the repository at this point in the history
  • Loading branch information
shurivich committed Apr 18, 2024
1 parent 6c8e6cc commit a5cac62
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions tracer/src/Datadog.Trace/Debugger/Upload/DiagnosticsUploadApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Datadog.Trace.Debugger.Upload
{
internal class DiagnosticsUploadApi : DebuggerUploadApiBase
{
private const string LegacyEndpoint = "debugger/v1/input";
private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor<DiagnosticsUploadApi>();

private readonly IApiRequestFactory _apiRequestFactory;
Expand Down Expand Up @@ -60,21 +61,23 @@ public override async Task<bool> SendBatchAsync(ArraySegment<byte> data)

private Task<IApiResponse> PostAsync(string uri, ArraySegment<byte> data)
{
if (uri.Contains("diagnostics"))
var isLegacy = uri.Contains(LegacyEndpoint);
if (isLegacy)
{
var multipart = _apiRequestFactory.Create(new Uri(uri));
var multipartRequest = (IMultipartApiRequest)multipart;

return
multipartRequest
.PostAsync(new MultipartFormItem[]
{
new("event", MimeTypes.Json, "event.json", data)
});
return _apiRequestFactory
.Create(new Uri(uri))
.PostAsync(data, MimeTypes.Json);
}

var request = _apiRequestFactory.Create(new Uri(uri));
return request.PostAsync(data, MimeTypes.Json);
var multipart = _apiRequestFactory.Create(new Uri(uri));
var multipartRequest = (IMultipartApiRequest)multipart;

return
multipartRequest
.PostAsync(new MultipartFormItem[]
{
new("event", MimeTypes.Json, "event.json", data)
});
}
}
}

0 comments on commit a5cac62

Please sign in to comment.