-
-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Labels
.NETPull requests that update .net codePull requests that update .net codeBugSomething isn't workingSomething isn't working
Description
Package
Sentry.Profiling
.NET Flavor
.NET Core
.NET Version
9.0.? from mcr.microsoft.com/dotnet/sdk:9.0
OS
Linux
OS Version
Linux x64 from mcr.microsoft.com/dotnet/aspnet:9.0
Development Environment
Other
SDK Version
5.16.2
Self-Hosted Sentry Version
25.11.0
Workload Versions
not related
UseSentry or SentrySdk.Init call
appsettings.json:
"Logging": {
"LogLevel": {
"Default": "Information",
"System": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"Microsoft.EntityFrameworkCore": "Information",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
"Microsoft.AspNetCore.Hosting.Diagnostics": "None",
"ZiggyCreatures.Caching.Fusion": "None",
"Polly": "None"
}
},
"Sentry": {
"Dsn": "https://[email protected]/2",
"MinimumEventLevel": "Warning",
"MinimumBreadcrumbLevel": "Information",
"ProfilesSampleRate": 0.3
},
"OpenTelemetryOptions": {
"Endpoint": "https://alloy.xxxxxxxxxxxxxx",
"Protocol": "HttpProtobuf"
}Program.cs:
static void ConfigureTelemetry(WebApplicationBuilder builder)
{
OpenTelemetryBuilder openTelemetryBuilder = builder.Services.AddOpenTelemetry()
.ConfigureResource(r =>
{
r.AddService("gl-backend");
r.AddAttributes([new KeyValuePair<string, object>("environment", builder.Environment.EnvironmentName)]);
})
.WithTracing(t =>
{
t.AddAspNetCoreInstrumentation();
t.AddHttpClientInstrumentation();
t.AddSentry();
})
.WithMetrics(m =>
{
m.AddAspNetCoreInstrumentation();
m.AddHttpClientInstrumentation();
m.AddRuntimeInstrumentation();
})
.WithLogging(_ => { },
l =>
{
l.IncludeFormattedMessage = true;
l.IncludeScopes = true;
});
var sentryDsn = builder.Configuration.GetValue<string?>("Sentry:Dsn");
if (!string.IsNullOrWhiteSpace(sentryDsn))
builder.WebHost.UseSentry((SentryAspNetCoreOptions s) =>
{
s.AdjustStandardEnvironmentNameCasing = false;
s.UseOpenTelemetry();
s.DisableSentryHttpMessageHandler = true;
s.AddProfilingIntegration();
// Remove nugets from in-app frames. This way nugets won't be considered "App" frames and will be considered "Library" frames.
Array.ForEach(Program._excludeNugetsFromSentryAppFrames, s.AddInAppExclude);
});
var otelOptions = builder.Configuration.GetSection("OpenTelemetryOptions").Get<OpenTelemetryOptions>();
if (otelOptions?.Endpoint != null) { openTelemetryBuilder.UseOtlpExporter(otelOptions.Protocol, otelOptions.Endpoint); }
}
public partial class Program
{
private static readonly string[] _excludeNugetsFromSentryAppFrames =
[
"MySqlConnector", "Pomelo.EntityFrameworkCore.MySql", "ShipEngine", "Yarp", "Rebus", "Amazon", "AWSSDK", "ZiggyCreatures.FusionCache",
"OpenTelemetry", "EntityFramework.Exceptions.Common", "object InvokeStub_TaskAwaiter", "TickerQ", "Duende.IdentityModel",
"Duende.AccessTokenManagement", "Xero", "Scriban", "BarcodeStandard"
];
}Steps to Reproduce
- Use application
- Inspect profiling page on Sentry
Expected Result
Profiles of application code.
Actual Result
No profiles, except Program.cs main function.

Metadata
Metadata
Assignees
Labels
.NETPull requests that update .net codePull requests that update .net codeBugSomething isn't workingSomething isn't working
Projects
Status
No status