Description
On version7, events that the Serilog sink captures no longer list nuget:Sentry.Serilog in sdk.packages. The NLog, log4net and Microsoft.Extensions.Logging pull requests for #5245 drop their packages the same way.
We decided in #5497 that sdk.name should identify the integration that initialized the SDK, so the logging integrations stopped setting the name. The same commits also removed their AddPackage calls. sdk.packages is a list, so an integration can add its package without changing the name. Structured logs record the logging integration in their origin, for example auto.log.serilog, but events have no origin. After this change, nothing on an event records which logging integration captured it.
None of this has shipped. #5573 is merged into version7, and #5585, #5592 and #5595 are still open.
Reproduction
Run samples/Sentry.Samples.AspNetCore.Serilog, log an error through Serilog during a request, and compare the sdk block of the event on each branch.
On main, the event lists three packages:
"sdk": {
"name": "sentry.dotnet.aspnetcore",
"version": "6.11.1-dev",
"packages": [
{
"name": "nuget:Sentry.Serilog",
"version": "6.11.1-dev"
},
{
"name": "nuget:Sentry.AspNetCore",
"version": "6.11.1-dev"
},
{
"name": "nuget:sentry.dotnet",
"version": "6.11.1-dev"
}
]
}
On version7, nuget:Sentry.Serilog is missing:
"sdk": {
"name": "sentry.dotnet.aspnetcore",
"version": "7.0.0-prerelease",
"packages": [
{
"name": "nuget:Sentry.AspNetCore",
"version": "7.0.0-prerelease"
},
{
"name": "nuget:sentry.dotnet",
"version": "7.0.0-prerelease"
}
]
}
The name matches on both branches because the ASP.NET Core request scope overwrites it. An event from the NLog target on the #5585 branch has the same gap. Its packages list only contains nuget:sentry.dotnet.
No test catches this. test/Sentry.Testing/VerifyExtensions.cs calls IgnoreMembersWithType<SdkVersion>(), so the snapshot tests skip the sdk block of events.
Proposed fix
Restore the package on the events each logging integration creates, and leave sdk.name as it is. This table shows where 6.x added the package.
| Integration |
6.x |
Removed in |
| Serilog |
SentrySink added it to each event |
#5573 |
| NLog |
SentryTarget added it to each event |
#5585 |
| log4net |
SentryAppender added it to each event |
#5592 |
| Microsoft.Extensions.Logging |
SentryLoggerProvider added it to a scope that it pushed |
#5595 |
For Microsoft.Extensions.Logging, adding the package to the events that SentryLogger creates would match the other three. Each integration should get a test that captures an event and checks sdk.packages.
This needs to land on version7 before 7.0.0 ships. It can follow #5595, so that one change covers all four integrations.
Description
On
version7, events that the Serilog sink captures no longer listnuget:Sentry.Seriloginsdk.packages. The NLog, log4net and Microsoft.Extensions.Logging pull requests for #5245 drop their packages the same way.We decided in #5497 that
sdk.nameshould identify the integration that initialized the SDK, so the logging integrations stopped setting the name. The same commits also removed theirAddPackagecalls.sdk.packagesis a list, so an integration can add its package without changing the name. Structured logs record the logging integration in their origin, for exampleauto.log.serilog, but events have no origin. After this change, nothing on an event records which logging integration captured it.None of this has shipped. #5573 is merged into
version7, and #5585, #5592 and #5595 are still open.Reproduction
Run
samples/Sentry.Samples.AspNetCore.Serilog, log an error through Serilog during a request, and compare thesdkblock of the event on each branch.On
main, the event lists three packages:On
version7,nuget:Sentry.Serilogis missing:The name matches on both branches because the ASP.NET Core request scope overwrites it. An event from the NLog target on the #5585 branch has the same gap. Its
packageslist only containsnuget:sentry.dotnet.No test catches this.
test/Sentry.Testing/VerifyExtensions.cscallsIgnoreMembersWithType<SdkVersion>(), so the snapshot tests skip thesdkblock of events.Proposed fix
Restore the package on the events each logging integration creates, and leave
sdk.nameas it is. This table shows where 6.x added the package.SentrySinkadded it to each eventSentryTargetadded it to each eventSentryAppenderadded it to each eventSentryLoggerProvideradded it to a scope that it pushedFor Microsoft.Extensions.Logging, adding the package to the events that
SentryLoggercreates would match the other three. Each integration should get a test that captures an event and checkssdk.packages.This needs to land on
version7before 7.0.0 ships. It can follow #5595, so that one change covers all four integrations.