Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit fdf0afe

Browse files
committed
Report exception via diagnostics
1 parent 2076aac commit fdf0afe

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -280,33 +280,31 @@ public async Task SendAsync(Batch batch)
280280

281281
MessagingEventSource.Log.MessageSendStart(this.ClientId, batch.Length);
282282

283-
// var isDiagnosticSourceEnabled = ServiceBusDiagnosticSource.IsEnabled();
284-
// var activity = isDiagnosticSourceEnabled ? this.diagnosticSource.SendStart(messageList) : null;
285-
Task sendTask = null;
283+
var isDiagnosticSourceEnabled = ServiceBusDiagnosticSource.IsEnabled();
284+
// var activity = isDiagnosticSourceEnabled ? this.diagnosticSource.SendStart(messageList) : null;
285+
Task sendTask;
286286

287287
try
288288
{
289-
//var processedMessages = await this.ProcessMessages(messageList).ConfigureAwait(false);
290-
291289
sendTask = this.RetryPolicy.RunOperation(() => this.OnSendAsync(batch.ToAmqpMessage), this.OperationTimeout);
292290
await sendTask.ConfigureAwait(false);
293291
}
294292
catch (Exception exception)
295293
{
296-
// if (isDiagnosticSourceEnabled)
297-
// {
298-
// this.diagnosticSource.ReportException(exception);
299-
// }
294+
if (isDiagnosticSourceEnabled)
295+
{
296+
this.diagnosticSource.ReportException(exception);
297+
}
300298

301299
MessagingEventSource.Log.MessageSendException(this.ClientId, exception);
302300
throw;
303301
}
304-
finally
305-
{
306-
// this.diagnosticSource.SendStop(activity, messageList, sendTask?.Status);
307-
}
302+
// finally
303+
// {
304+
// this.diagnosticSource.SendStop(activity, messageList, sendTask?.Status);
305+
// }
308306

309-
// MessagingEventSource.Log.MessageSendStop(this.ClientId);
307+
// MessagingEventSource.Log.MessageSendStop(this.ClientId);
310308
}
311309

312310
/// <summary>

0 commit comments

Comments
 (0)