New .NET SDKs - Feedback wanted

This is the home for discussions about the new .NET SDKs.

For a more general (non .NET specific) discussion of the unified API, please check:

The new SDK is called Sentry and is published on NuGet with that name.

Even though this package can be used by pretty much any type of .NET application, we already developed a few integration built on top of it for a couple of logging libraries and web frameworks. That is so we can make sure the necessary abstractions are in place to extend it further.

That means that if you see a package to a logging library like Sentry.Log4Net, this package is actually a wrapper around Sentry and send events coming from that logging library. By using this package, you also have access to the functionality exposed by Sentry.

All features listed below are part of Sentry package and are also available through all integrations that we’ll discuss later.

  • Automatic Captures global unhandled exceptions (AppDomain)
  • Scope management
  • Duplicate events automatically dropped
  • Events from the same exception automatically dropped
  • Web proxy support
  • Compress request body (buffered or streamed)
  • Event flooding protection (429 retry-after and internal bound queue)
  • DSN discovered via environment variable
  • Release (app version) reported automatically (AssemblyInformationalVersionAttribute, AssemblyVersion or env var)
  • CLS Compliant
  • SourceLink (including PDB in nuget package)
  • Device OS info sent
  • Device Runtime info sent
  • Tested on Windows, Linux and macOS
  • Tested on .NET Core, .NET Framework and Mono

The current integrations are:

  • Sentry.Extensions.Logging
    • The integration to the new logging library from Microsoft which was created as part of ASP.NET Core.
    • BeginScope data added to scope (sent with events)
    • LogError or higher automatically captures an event
    • LogInformation or higher added as breadcrumb. Sent with next events.
    • Without any configuration this package will send any Error and Warning messages to Sentry. Any Information message is stored as a breadcrumb and is sent to Sentry with the following events.
    • What LogLevel should store breadcrumb and/or send an event is configurable and you can disable one of the other too.
  • Sentry.AspNetCore
    • This allows you configure Sentry via appsettings.json and other providers used with the framework
    • Easy ASP.NET Core integration, single line: UseSentry.
    • Captures exceptions handled by the framework UseExceptionHandler and Error page display.
    • Any event sent will include relevant (of that request) application log messages
    • RequestId as tag
    • URL as tag
    • User data sent
    • Environment is automatically set (IHostingEnvironment)
    • Request payload can be captured if opt-in
    • Support for EventProcessors registered with DI
    • Support for ExceptionProcessors registered with DI
    • Captures logs from the transaction (uses Sentry.Extensions.Logging)
    • Server OS info sent
    • Server Runtime info sent
    • Request headers sent
    • Tested on Windows, Linux and macOS
    • Tested on .NET Core, .NET Framework and Mono
  • Sentry.Log4Net
    • Allows initializing the SDK through web.config or app.config
    • Requires no code change (only add the appender)
  • Sentry.EntityFramework
    • Entity Framework 6 integration
    • Can be used with any type of app, ASP.NET or ASP.NET Core or desktop.
    • Captures the exact validation errors from DbEntityValidationExceptions
    • Sends queries as breadcrumbs

All packages mentioned above include DLLs that are strong named.

Code can be found on GitHub.
This repo for: Sentry, Sentry.AspNetCore, Sentry.Log4net, Sentry.Extensions.Logging
And this repo includes the Sentry.EntityFramework

The GitHub repositories where we develop the SDKs include some samples which are useful during development. On top of that, we’ve created a dedicated samples repo for .NET

If you want to chat online, you can find me at: https://gitter.im/getsentry/dotnet

1 Like