Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
36fde27
feat: Serilog sink no longer initializes the SDK
jamescrosswell Sep 14, 2026
5385388
Accept API verifier changes
getsentry-bot Sep 14, 2026
f7f48a5
Merge remote-tracking branch 'origin/version7' into feat/no-init-from…
jamescrosswell Sep 14, 2026
9f8ec8c
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 14, 2026
c72c26e
Tweak comments in the samples
jamescrosswell Sep 17, 2026
cafeb7b
feat: NLog target no longer initializes the SDK
jamescrosswell Sep 17, 2026
19db652
Tweaked wording
jamescrosswell Sep 17, 2026
489d7ce
feat: NLog target flushes using the SDK's FlushTimeout
jamescrosswell Sep 17, 2026
6438db5
feat: log4net appender no longer initializes the SDK
jamescrosswell Sep 17, 2026
d2e7281
feat: Microsoft.Extensions.Logging integration no longer initializes …
jamescrosswell Sep 17, 2026
d318a86
feat: SentryHostOptions replaces SentryLoggingOptions as the base for…
jamescrosswell Sep 18, 2026
0aada87
docs: drop unused Sentry settings from the Serilog sample appsettings
jamescrosswell Sep 21, 2026
5acfa5e
fix(serilog): make the UseSerilog warning check atomic
jamescrosswell Sep 21, 2026
5686eba
refactor: the logging integration no longer stamps the SDK name or di…
jamescrosswell Sep 22, 2026
d038075
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 22, 2026
3307c30
refactor: the Serilog sink no longer sets the SDK name
jamescrosswell Sep 22, 2026
bbc1166
Merge branch 'feat/no-init-from-logging-5245' into feat/no-init-from-…
jamescrosswell Sep 22, 2026
62dad84
refactor: the NLog target no longer sets the SDK name
jamescrosswell Sep 22, 2026
b9b9dda
Merge branch 'feat/no-init-from-logging-nlog-5245' into feat/no-init-…
jamescrosswell Sep 22, 2026
5e04b92
refactor: the log4net appender no longer sets the SDK name
jamescrosswell Sep 22, 2026
341d3a0
Merge branch 'feat/no-init-from-logging-log4net-5245' into feat/no-in…
jamescrosswell Sep 22, 2026
f6c72ae
refactor: structured logs from Microsoft.Extensions.Logging no longer…
jamescrosswell Sep 22, 2026
72d27f9
feat(serilog): configuring a DSN on the sink now fails with a migrati…
ric-oliv Sep 22, 2026
9d27112
test(serilog): pin the DSN tombstone against Serilog.Settings.Configu…
jamescrosswell Sep 22, 2026
f6039d3
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 22, 2026
ab2bb85
feat(nlog): configuring a DSN on the target now fails with a migratio…
jamescrosswell Sep 22, 2026
ed73567
docs(serilog): reword the DSN migration error
jamescrosswell Sep 22, 2026
6517170
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 22, 2026
5ab9e8f
docs(nlog): reword the DSN migration error to match Serilog
jamescrosswell Sep 22, 2026
95cbdae
Merge remote-tracking branch 'origin/feat/no-init-from-logging-nlog-5…
jamescrosswell Sep 22, 2026
ca044b4
feat(log4net): configuring a DSN on the appender now reports a migrat…
jamescrosswell Sep 22, 2026
d15c91e
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 22, 2026
2e9b9c7
feat(mel): configuring a DSN through the logging integration now fail…
jamescrosswell Sep 22, 2026
6649270
fix(mel): only treat a supplied Dsn or InitializeSdk as a migration e…
jamescrosswell Sep 23, 2026
a1bf334
fix(serilog): the Sentry sink registers the Serilog scope event proce…
ric-oliv Sep 23, 2026
6c8c4d9
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 23, 2026
7b88c80
fix(serilog): register the scope event processor atomically
jamescrosswell Sep 23, 2026
f76ac32
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 23, 2026
53f4144
refactor(serilog): use the Lock shim for the registration lock
jamescrosswell Sep 23, 2026
0925c1d
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 23, 2026
63d5b84
Merge remote-tracking branch 'origin/feat/no-init-from-logging-nlog-5…
jamescrosswell Sep 23, 2026
63cafc5
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 23, 2026
14e59b1
Tidy comments
jamescrosswell Sep 23, 2026
bbf2ffd
Merge remote-tracking branch 'origin/version7' into feat/no-init-from…
jamescrosswell Sep 23, 2026
a8a1ea9
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 23, 2026
c6327ce
Merge remote-tracking branch 'origin/feat/no-init-from-logging-nlog-5…
jamescrosswell Sep 23, 2026
aa11db1
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 23, 2026
ba78b29
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 23, 2026
a082174
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 23, 2026
fbbaa39
docs: samples are exempt from the no-comments rule
jamescrosswell Sep 23, 2026
5f4f1d1
Apply suggestion from @jamescrosswell
jamescrosswell Sep 23, 2026
2925072
feat(serilog): warn at runtime when the sink drops events because Sen…
jamescrosswell Sep 28, 2026
5ff4ec6
Merge remote-tracking branch 'origin/feat/no-init-from-logging-5245' …
jamescrosswell Sep 28, 2026
0a57f71
feat(nlog): warn at runtime when the target drops events because Sent…
jamescrosswell Sep 28, 2026
abfbe29
Merge remote-tracking branch 'origin/feat/no-init-from-logging-nlog-5…
jamescrosswell Sep 28, 2026
3f30836
feat(log4net): warn at runtime when the appender drops events because…
jamescrosswell Sep 28, 2026
e133cea
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 28, 2026
7e17339
feat(mel): warn at runtime when the integration drops events because …
jamescrosswell Sep 28, 2026
c5fbba6
docs(mel): match the other integrations' migration-error phrasing
jamescrosswell Sep 29, 2026
7d92ca3
Merge remote-tracking branch 'origin/version7' into feat/no-init-from…
jamescrosswell Sep 29, 2026
9999e9a
Merge remote-tracking branch 'origin/feat/no-init-from-logging-nlog-5…
jamescrosswell Sep 29, 2026
dfcb80c
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 29, 2026
9d467f1
fix: UseSentry now initializes Sentry even when Logging.AddSentry ran…
jamescrosswell Sep 29, 2026
248c671
test(log4net): Run the configuration binding tests against log4net 3 …
ric-oliv Sep 30, 2026
ae9cdda
fix(nlog): report a stale dsn and accept initializeSdk=false (#5652)
ric-oliv Sep 30, 2026
230348b
Merge remote-tracking branch 'origin/feat/no-init-from-logging-nlog-5…
jamescrosswell Sep 30, 2026
af47132
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 30, 2026
f79645c
Merge remote-tracking branch 'origin/feat/no-init-from-logging-log4ne…
jamescrosswell Sep 30, 2026
b3d2e57
test: keep the real environment out of the disabled-SDK tests
jamescrosswell Sep 30, 2026
04a5a54
feat: read core SDK settings only from the Sentry configuration section
jamescrosswell Oct 1, 2026
ae42363
fix(blazor): bind configuration before the UseSentry callback
jamescrosswell Oct 1, 2026
d3a2159
Format code
getsentry-bot Oct 1, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class SentryStructuredLoggerBenchmarks
[GlobalSetup]
public void Setup()
{
SentryLoggingOptions options = new()
SentryOptions options = new()
{
Dsn = DsnSamples.ValidDsn,
};
Expand All @@ -34,7 +34,7 @@ public void Setup()
};

_hub = new Hub(options, DisabledHub.Instance);
_logger = new SentryStructuredLogger("CategoryName", options, _hub, clock, sdk);
_logger = new SentryStructuredLogger("CategoryName", _hub, clock, sdk);
_logRecord = new LogRecord(LogLevel.Information, new EventId(2025, "EventName"), new InvalidOperationException("exception-message"), "Number={Number}, Text={Text}", 2018, "message");
}

Expand Down
19 changes: 11 additions & 8 deletions samples/Sentry.Samples.GenericHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@

var builder = Host.CreateApplicationBuilder();

builder.Logging.AddConfiguration(builder.Configuration);

// Initialise the Sentry SDK. The logging integration added below only forwards log messages to Sentry.
using var sentry = SentrySdk.Init(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// A DSN is required. You can set it here in code, via the SENTRY_DSN environment variable or in your
// appsettings.json file.
// See https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/#configure
builder.Logging.AddSentry(SamplesShared.Dsn);
#else
builder.Logging.AddSentry();
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#endif
// Send user name and machine name
options.SendDefaultPii = true;
});

builder.Logging.AddSentry();

builder.Services.AddHostedService<SampleHostedService>();

Expand Down
11 changes: 4 additions & 7 deletions samples/Sentry.Samples.GenericHost/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
"LogLevel": {
"Default": "Trace"
},
// The logging integration is configured here, under its own provider section
"Sentry": {
"LogLevel": {
"Default": "Information" // Configure structured logs
}
},
"MinimumBreadcrumbLevel": "Debug",
"MinimumEventLevel": "Warning"
}
},
"Sentry": {
//"Dsn": "TODO: Configure your DSN here and uncomment this line",
"MinimumBreadcrumbLevel": "Debug",
"MinimumEventLevel": "Warning",
"SendDefaultPii": true // Send user name and machine name
}
}
11 changes: 11 additions & 0 deletions samples/Sentry.Samples.Log4Net/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ internal class Program

private static void Main()
{
// Initialise the Sentry SDK.
using var _ = SentrySdk.Init(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#endif
options.Environment = "dev";
});

// Set the user running the process the current principal
// Appender was configured to send the user with the event
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
Expand Down
6 changes: 3 additions & 3 deletions samples/Sentry.Samples.Log4Net/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

This is a simple console application that demonstrates how you can add Sentry to your applications using log4net.

`Program.cs` doesn't have any reference to Sentry. In fact, it doesn't even include a `using Sentry;` directive.
The integration is simply done by adding the [Sentry.Log4Net](https://www.nuget.org/packages/Sentry.Log4Net) package to you project and configuring the appender via xml.
The Sentry SDK is initialised via the call to `SentrySdk.Init` in `Program.cs`. Log events are sent to Sentry by adding the
[Sentry.Log4Net](https://www.nuget.org/packages/Sentry.Log4Net) package to your project and configuring the appender via xml.

It's also possible to use the SDK directly on your app as the documentation describes.
If you for example call `SentrySdk.AddBreadcrumb("crumb")`, all log4net events will include that breadcrumb.
Expand All @@ -12,7 +12,7 @@ If you for example call `SentrySdk.AddBreadcrumb("crumb")`, all log4net events w

## Running this sample

> First modify the `app.config` and add **your own DSN**. You can get one at [sentry.io](sentry.io). This will make sure you can see the result of running this app by looking at what this creates in Sentry.
> First modify `Program.cs` and add **your own DSN**. You can get one at [sentry.io](sentry.io). This will make sure you can see the result of running this app by looking at what this creates in Sentry.

Now you're ready to run the code.

Expand Down
7 changes: 1 addition & 6 deletions samples/Sentry.Samples.Log4Net/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
</layout>
</appender>
<appender name="SentryAppender" type="Sentry.Log4Net.SentryAppender, Sentry.Log4Net">
<!--Defining the DSN here allows log4net integration to initialize the SDK-->
<!--You can leave the DSN out of this configuration file and initialize the SDK-->
<!--via code (SentrySdk.Init) or via another integration like ASP.NET-->
<!--The SDK only needs to be initialized once, you can choose where to do that-->
<!-- <Dsn value="TODO: Configure your DSN here and uncomment this line" /> -->
<!--Configures the Sentry appender. Sentry itself is initialised in Program.cs-->
<!--Sends the log event Identity value as the user-->
<SendIdentity value="true" />
<Environment value="dev" />
<!--If MinimumEventLevel is specified, every event above threshold
and below MinimumEventLevel will be added as a breadcrumb.-->
<MinimumEventLevel value="ERROR" />
Expand Down
48 changes: 25 additions & 23 deletions samples/Sentry.Samples.ME.Logging/Program.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
using Microsoft.Extensions.Logging;
using Sentry.Extensions.Logging;

using var loggerFactory = LoggerFactory.Create(builder =>
// Initialise the Sentry SDK. The logging integration added below only forwards log messages to Sentry.
using var sentry = SentrySdk.Init(options =>
{
builder.AddConsole();
builder.AddSentry(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#endif

// Set to true to SDK debugging to see the internal messages through the logging library.
options.Debug = false;
// Configure the level of Sentry internal logging
options.DiagnosticLevel = SentryLevel.Debug;
// Set to true to SDK debugging to see the internal messages through the logging library.
options.Debug = false;
// Configure the level of Sentry internal logging
options.DiagnosticLevel = SentryLevel.Debug;

options.MaxBreadcrumbs = 150; // Increasing from default 100
options.Release = "e386dfd"; // If not set here, SDK looks for it on main assembly's AssemblyInformationalVersion and AssemblyVersion

options.SetBeforeSendLog(static log =>
{
log.SetAttribute("attribute-key", "attribute-value");
return log;
});
});

options.MaxBreadcrumbs = 150; // Increasing from default 100
options.Release = "e386dfd"; // If not set here, SDK looks for it on main assembly's AssemblyInformationalVersion and AssemblyVersion
SentrySdk.ConfigureScope(s => s.SetTag("RootScope", "sent with all events"));

using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddConsole();
builder.AddSentry(options =>
{
// Optionally configure options: The default values are:
options.MinimumBreadcrumbLevel = LogLevel.Information; // It requires at least this level to store breadcrumb
options.MinimumEventLevel = LogLevel.Error; // This level or above will result in event sent to Sentry

options.SetBeforeSendLog(static log =>
{
log.SetAttribute("attribute-key", "attribute-value");
return log;
});

// Don't keep as a breadcrumb or send events for messages of level less than Critical with exception of type DivideByZeroException
options.AddLogEntryFilter((_, level, _, exception) => level < LogLevel.Critical && exception is DivideByZeroException);

options.ConfigureScope(s => s.SetTag("RootScope", "sent with all events"));
});
// Don't send logs for messages of level less than Warning for category Program
builder.AddFilter(typeof(Program).FullName, LogLevel.Warning);
Expand Down Expand Up @@ -86,8 +90,6 @@
Dependency.Work("8 - This unhandled exception is captured and includes Scope (A, B) and crumbs: (2, 4, 5) and event (3) ");
}

// Disposing the LoggerFactory will close the SDK since it was initialized through
// the integration while calling .Init()

internal static class Dependency
{
Expand Down
12 changes: 1 addition & 11 deletions samples/Sentry.Samples.NLog/NLog.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
<targets>
<target name="logconsole" xsi:type="ColoredConsole" />

<!-- You can also add a `dsn` property to the following target (with the DSN of your Sentry project):
See Program.cs for the DSN used in the code-only example-->

<!-- This only configures the Sentry target. Sentry itself is initialised in Program.cs -->
<target xsi:type="Sentry" name="sentry"
environment="Development"
includeEventProperties="True"
layout="${message}"
breadcrumbLayout="${message}"
Expand All @@ -24,13 +21,6 @@
includeEventPropertiesAsTags="True"
minimumEventLevel="Error">

<!-- Advanced options can be configured here-->
<options
attachStacktrace="true"
sendDefaultPii="true"
shutdownTimeoutSeconds="5"
/>

<!--Optionally add any desired additional Tags that will be sent with every message -->
<tag name="exception" layout="${exception:format=shorttype}" includeEmptyValue="false" />

Expand Down
28 changes: 14 additions & 14 deletions samples/Sentry.Samples.NLog/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ public static class Program

private static void Main()
{
// Initialise the Sentry SDK
using var _ = SentrySdk.Init(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// A DSN is required. You can set here in code, or you can set it in the SENTRY_DSN environment variable.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#endif
options.AttachStacktrace = true;
options.SendDefaultPii = true; // Send Personal Identifiable information like the username of the user logged in to the device
});

try
{
// You can configure your logger using a configuration file:
Expand Down Expand Up @@ -97,28 +109,18 @@ private static void UsingNLogConfigFile()

private static void UsingCodeConfiguration()
{
// Other overloads exist, for example, configure the SDK with only the DSN or no parameters at all.
// Configure NLog to send logs to Sentry
var config = LogManager.Configuration = new LoggingConfiguration();
_ = config
.AddSentry(options =>
{
#if !SENTRY_DSN_DEFINED_IN_ENV
// A DSN is required. You can set here in code, in the SENTRY_DSN environment variable or in the
// NLog.config file.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
options.Dsn = SamplesShared.Dsn;
#endif
options.Layout = "${message}";
options.BreadcrumbLayout = "${logger}: ${message}"; // Optionally specify a separate format for breadcrumbs

options.MinimumBreadcrumbLevel = LogLevel.Debug; // Debug and higher are stored as breadcrumbs (default is Info)
options.MinimumEventLevel = LogLevel.Error; // Error and higher is sent as event (default is Error)

options.AttachStacktrace = true;
options.SendDefaultPii = true; // Send Personal Identifiable information like the username of the user logged in to the device
options.MinimumEventLevel = LogLevel.Error; // Error and higher are sent as events (default is Error)

options.IncludeEventDataOnBreadcrumbs = true; // Optionally include event properties with breadcrumbs
options.ShutdownTimeoutSeconds = 5;

//Optionally specify user properties via NLog (here using MappedDiagnosticsLogicalContext as an example)
options.User = new SentryNLogUser
Expand All @@ -134,8 +136,6 @@ private static void UsingCodeConfiguration()
};

options.AddTag("logger", "${logger}"); // Send the logger name as a tag

// Other configuration
});

config.AddTarget(new DebuggerTarget("debugger"));
Expand Down
26 changes: 3 additions & 23 deletions samples/Sentry.Samples.NLog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

This is a simple console application that demonstrates how you can add Sentry to your application using NLog.

This project attempts to sample the integration by using code only and also via the configuration file.
In both cases **you need to add your own DSN** so you can see the events sent in your Sentry project.
This project demonstrates configuring Sentry and NLog via code and configuration.
The Sentry target configures NLog to send logs to Sentry. The Sentry SDK itself is initialised via the call to `SentrySdk.Init`
in `Program.cs`, so **you need to add your own DSN** there to see the events sent in your Sentry project.

You can get your [Sentry DSN at sentry.io](https://sentry.io).
Make sure to add it to both `NLog.config` and `Program.cs` in this directory.

## Configuration of NLog.config
The following options are available for the NLog Sentry Target:

```xml
<target xsi:type="Sentry" name="sentry"
dsn="https://123@sentry.io/456"
environment="${environment:cached=true:ASPNETCORE_ENVIRONMENT}"
release="${assembly-version:cached=true:type=File}"
layout="${message}"
includeEventProperties="True"
includeMdlc="False"
Expand All @@ -25,17 +22,9 @@ The following options are available for the NLog Sentry Target:
ignoreEventsWithNoException="False"
includeEventDataOnBreadcrumbs="False"
includeEventPropertiesAsTags="True"
initializeSdk="True"
flushTimeoutSeconds="15"
>
<tag name="exception" layout="${exception:format=shorttype}" includeEmptyValue="false" /><!-- Repeatable SentryEvent Tags -->
<contextproperty name="threadid" layout="${threadid}" includeEmptyValue="true" /> <!-- Repeatable SentryEvent Data -->
<!-- Advanced options can be configured here-->
<options
sendDefaultPii="False"
isEnvironmentUser="True"
attachStacktrace="False"
/>
<!-- Optionally specify user properties via NLog (here using MappedDiagnosticsLogicalContext as an example) -->
<user
id="${mdlc:item=id}"
Expand All @@ -48,10 +37,6 @@ The following options are available for the NLog Sentry Target:
</target>
```

* **dsn** - Sentry Data Source Name Address. See also https://sentry.io
* **initializeSdk** - Whether the NLog target should initialize the Sentry SDK (Using Dsn). Default: _True_
* **environment** - Application Environment sent to Sentry
* **release** - Application Release Version sent to Sentry
* **layout** - NLog Layout for rendering SentryEvent message. Default: _${message}_
* **includeEventProperties** - Include LogEvent properties as Data on SentryEvent. Default: _True_
* **includeEventPropertiesAsTags** - Include LogEvent properties as extra Tags on SentryEvent. Default: _False_
Expand All @@ -61,17 +46,12 @@ The following options are available for the NLog Sentry Target:
* **minimumEventLevel** - Send NLog LogEvents as SentryEvent when matching severity (or worse). Default: _Error_
* **minimumBreadcrumbLevel** - Send NLog LogEvents as Breadcrumbs when matching severity (or worse). Default: _Info_
* **ignoreEventsWithNoException** - Ignore NLog LogEvents without an exception. Default: _False_
* **flushTimeoutSeconds** - Flush timeout in seconds before aborting flush to Sentry. Default: _15_
* **user**
* **id**
* **username**
* **email**
* **ipAddress**
* **other** - Any arbitrary key-value pairs to be included as properties for a user on every event.
* **options**
* **sendDefaultPii** - Whether to include default Personal Identifiable information (UserName / IP-Address). Default: _False_
* **isEnvironmentUser** - Lookup Environment.User if having enabled **sendDefaultPii**. Default: _True_
* **attachStacktrace** - Whether to send the stack trace of a event captured without an exception. Default: _False_

There is filtering logic in the Sentry Target that is usually handled by NLog Logging Rules and Filters.
Mostly because the same Sentry Target is writing both breadcrumbs and actual SentryEvents.
Expand Down
22 changes: 11 additions & 11 deletions samples/Sentry.Samples.OpenTelemetry.AzureFunctions/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
var dsn = SamplesShared.Dsn;
#endif

// Initialise the Sentry SDK. The logging integration added below only forwards log messages to Sentry.
using var sentry = SentrySdk.Init(options =>
{
options.Dsn = dsn;
options.TracesSampleRate = 1.0;
options.UseOtlp(); // <-- Configure Sentry to use open telemetry
options.DisableSentryHttpMessageHandler = true; // So Sentry doesn't also create spans for outbound HTTP requests
options.Debug = true;
});

var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices(services =>
Expand All @@ -25,17 +35,7 @@
.AddHttpClientInstrumentation(); // From OpenTelemetry.Instrumentation.Http... adds automatic tracing for outgoing HTTP requests
});
})
.ConfigureLogging(logging =>
{
logging.AddSentry(options =>
{
options.Dsn = dsn;
options.TracesSampleRate = 1.0;
options.UseOtlp(); // <-- Configure Sentry to use open telemetry
options.DisableSentryHttpMessageHandler = true; // So Sentry doesn't also create spans for outbound HTTP requests
options.Debug = true;
});
})
.ConfigureLogging(logging => logging.AddSentry())
.Build();

await host.RunAsync();
Loading
Loading