You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
+69
Original file line number
Diff line number
Diff line change
@@ -517,6 +517,75 @@ public Activity AddEvent(ActivityEvent e)
517
517
returnthis;
518
518
}
519
519
520
+
/// <summary>
521
+
/// Add an <see cref="ActivityEvent" /> object containing the exception information to the <see cref="Events" /> list.
522
+
/// </summary>
523
+
/// <param name="exception">The exception to add to the attached events list.</param>
524
+
/// <param name="tags">The tags to add to the exception event.</param>
525
+
/// <param name="timestamp">The timestamp to add to the exception event.</param>
526
+
/// <returns><see langword="this" /> for convenient chaining.</returns>
527
+
/// <remarks>
528
+
/// <para>- The name of the event will be "exception", and it will include the tags "exception.message", "exception.stacktrace", and "exception.type",
529
+
/// in addition to the tags provided in the <paramref name="tags"/> parameter.</para>
530
+
/// <para>- Any registered <see cref="ActivityListener"/> with the <see cref="ActivityListener.ExceptionRecorder"/> callback will be notified about this exception addition
531
+
/// before the <see cref="ActivityEvent" /> object is added to the <see cref="Events" /> list.</para>
532
+
/// <para>- Any registered <see cref="ActivityListener"/> with the <see cref="ActivityListener.ExceptionRecorder"/> callback that adds "exception.message", "exception.stacktrace", or "exception.type" tags
533
+
/// will not have these tags overwritten, except by any subsequent <see cref="ActivityListener"/> that explicitly overwrites them.</para>
/// <param name="timestamp">Event timestamp. Timestamp MUST only be used for the events that happened in the past, not at the moment of this call.</param>
/// ActivityListener allows listening to the start and stop Activity events and give the opportunity to decide creating the Activity for sampling scenarios.
15
20
/// </summary>
@@ -32,6 +37,11 @@ public ActivityListener()
32
37
/// </summary>
33
38
publicAction<Activity>?ActivityStopped{get;set;}
34
39
40
+
/// <summary>
41
+
/// Set or get the callback used to listen to <see cref="Activity"/> events when exceptions are added.
/// Set or get the callback used to decide if want to listen to <see cref="Activity"/> objects events which created using <see cref="ActivitySource"/> object.
0 commit comments