Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use RecordException in the example
  • Loading branch information
reyang committed Mar 1, 2021
commit e2a9cdd25e640e2d2816bddfb396b921cc95c92c
5 changes: 2 additions & 3 deletions docs/trace/exception-handling/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public static void Main()
{
options.SetErrorStatusOnException = true;
})
.SetSampler(new AlwaysOnSampler())
.AddSource("MyCompany.MyProduct.MyLibrary")
.SetSampler(new AlwaysOnSampler())
.AddConsoleExporter()
.Build();

Expand Down Expand Up @@ -68,8 +68,7 @@ private static void UnhandledExceptionHandler(object source, UnhandledExceptionE

while (activity != null)
{
activity.SetTag("exception.type", $"UnhandledException<{ex.GetType().Name}>");
activity.SetTag("exception.message", ex.Message);
activity.RecordException(ex);
activity.Dispose();
activity = activity.Parent;
}
Expand Down