-
-
Notifications
You must be signed in to change notification settings - Fork 226
Open
Labels
.NETPull requests that update .net codePull requests that update .net codeBugSomething isn't workingSomething isn't workingLogs
Description
Package
Sentry.AspNetCore
.NET Flavor
.NET Core
.NET Version
8.0.413
OS
Windows
OS Version
Windows 11 Enterprise 24H2
Development Environment
Visual Studio Code (Windows)
SDK Version
5.14.1
Self-Hosted Sentry Version
No response
Workload Versions
dotnet workload list
Installed Workload Id Manifest Version Installation Source
--------------------------------------------------------------------
Use `dotnet workload search` to find additional workloads to install.
UseSentry or SentrySdk.Init call
I just call builder.WebHost.UseSentry() in Program.cs.
Steps to Reproduce
- Create an ASP.NET Core hello world app
- Run
dotnet add package Sentry.AspNetCore - Edit appsettings.json as below
- Include this in Program.cs:
builder.WebHost.UseSentry();
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
},
"File": {
"Path": null
}
},
"Sentry": {
"Dsn": "https://[email protected]/xxx",
"SendDefaultPii": true,
"MaxRequestBodySize": "Always",
"MinimumBreadcrumbLevel": "Debug",
"MinimumEventLevel": "Debug",
"AttachStackTrace": true,
"Debug": true,
"DiagnosticLevel": "Error",
"TracesSampleRate": 1.0,
"Experimental": {
"EnableLogs": true
}
}
}Expected Result
https://docs.sentry.io/platforms/dotnet/guides/extensions-logging/logs/#server-attributes says there shall be a server.address attribute in Logs. There doesn't seem to be. I expected something like this where the server.address is present.
{
"payload_size": "577",
"project_id": "xxx",
"tags[microsoft.extensions.logging.event.id,number]": "2",
"timestamp_precise": "1756899350742000000",
"environment": "development",
"message": "Connection id \"0HNFARN182IEO\" stopped.",
"message.parameter.ConnectionId": "0HNFARN182IEO",
"message.template": "Connection id \"{ConnectionId}\" stopped.",
"microsoft.extensions.logging.category_name": "Microsoft.AspNetCore.Server.Kestrel.Connections",
"microsoft.extensions.logging.event.name": "ConnectionStop",
"release": "[email protected]+xxx",
"sdk.name": "sentry.dotnet.aspnetcore",
"sdk.version": "5.14.1",
"server.address": "Foo",
"severity": "debug",
"trace": "ad624f73866444b9a0f18424e4e0e64f",
"trace.parent_span_id": "60d35e983820623a",
"id": "dbfc4db54fe883ac1871d6985c0f9901",
"observed_timestamp_nanos": "1756899355847905746"
}Actual Result
I get this, notice server.address is not present:
{
"payload_size": "577",
"project_id": "xxx",
"tags[microsoft.extensions.logging.event.id,number]": "2",
"timestamp_precise": "1756899350742000000",
"environment": "development",
"message": "Connection id \"0HNFARN182IEO\" stopped.",
"message.parameter.ConnectionId": "0HNFARN182IEO",
"message.template": "Connection id \"{ConnectionId}\" stopped.",
"microsoft.extensions.logging.category_name": "Microsoft.AspNetCore.Server.Kestrel.Connections",
"microsoft.extensions.logging.event.name": "ConnectionStop",
"release": "[email protected]+xxx",
"sdk.name": "sentry.dotnet.aspnetcore",
"sdk.version": "5.14.1",
"severity": "debug",
"trace": "ad624f73866444b9a0f18424e4e0e64f",
"trace.parent_span_id": "60d35e983820623a",
"id": "dbfc4db54fe883ac1871d6985c0f9901",
"observed_timestamp_nanos": "1756899355847905746"
}I can put a server.address attribute there by changing my call to UseSentry like this:
builder.WebHost.UseSentry(o =>
{
o.Experimental.SetBeforeSendLog(static log =>
{
log.SetAttribute("server.address", Environment.MachineName);
return log;
});
});Having to do this is not consistent with the documentation at https://docs.sentry.io/platforms/dotnet/guides/extensions-logging/logs/#server-attributes
Metadata
Metadata
Assignees
Labels
.NETPull requests that update .net codePull requests that update .net codeBugSomething isn't workingSomething isn't workingLogs
Projects
Status
No status
Status
Waiting for: Product Owner