Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ targets:
nuget:Sentry.Maui:
nuget:Sentry.NLog:
nuget:Sentry.OpenTelemetry:
nuget:Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol:
nuget:Sentry.Serilog:
nuget:Sentry.Profiling:
2 changes: 2 additions & 0 deletions .generated.NoMobile.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<Project Path="src/Sentry.Maui.CommunityToolkit.Mvvm/Sentry.Maui.CommunityToolkit.Mvvm.csproj" />
<Project Path="src/Sentry.Maui/Sentry.Maui.csproj" />
<Project Path="src/Sentry.NLog/Sentry.NLog.csproj" />
<Project Path="src/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
<Project Path="src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj" />
<Project Path="src/Sentry.Profiling/Sentry.Profiling.csproj" />
<Project Path="src/Sentry.Serilog/Sentry.Serilog.csproj" />
Expand Down Expand Up @@ -171,6 +172,7 @@
<Project Path="test/Sentry.Maui.Tests/Sentry.Maui.Tests.csproj" />
<Project Path="test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj" />
<Project Path="test/Sentry.NLog.Tests/Sentry.NLog.Tests.csproj" />
<Project Path="test/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj" />
<Project Path="test/Sentry.OpenTelemetry.Tests/Sentry.OpenTelemetry.Tests.csproj" />
<Project Path="test/Sentry.Profiling.Tests/Sentry.Profiling.Tests.csproj" />
<Project Path="test/Sentry.Serilog.Tests/Sentry.Serilog.Tests.csproj" />
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Add support to send OTEL traces via OTLP ([#4899](https://github.com/getsentry/sentry-dotnet/pull/4899))

### Fixes

- The SDK now logs a `Warning` instead of an `Error` when being ratelimited ([#4927](https://github.com/getsentry/sentry-dotnet/pull/4927))
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Linux-NoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"src\\Sentry.Hangfire\\Sentry.Hangfire.csproj",
"src\\Sentry.Log4Net\\Sentry.Log4Net.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -63,6 +64,7 @@
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Linux.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
"src\\Sentry.Maui\\Sentry.Maui.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -72,6 +73,7 @@
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Windows-arm64.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
"src\\Sentry.Maui\\Sentry.Maui.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -71,6 +72,7 @@
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Windows.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
"src\\Sentry.Maui\\Sentry.Maui.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -74,6 +75,7 @@
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-macOS.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
"src\\Sentry.Maui\\Sentry.Maui.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -80,6 +81,7 @@
"test\\Sentry.Maui.Device.TestApp\\Sentry.Maui.Device.TestApp.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-CodeQL.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
"src\\Sentry.Maui\\Sentry.Maui.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<Project Path="src/Sentry.Maui.CommunityToolkit.Mvvm/Sentry.Maui.CommunityToolkit.Mvvm.csproj" />
<Project Path="src/Sentry.Maui/Sentry.Maui.csproj" />
<Project Path="src/Sentry.NLog/Sentry.NLog.csproj" />
<Project Path="src/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
<Project Path="src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj" />
<Project Path="src/Sentry.Profiling/Sentry.Profiling.csproj" />
<Project Path="src/Sentry.Serilog/Sentry.Serilog.csproj" />
Expand Down Expand Up @@ -171,6 +172,7 @@
<Project Path="test/Sentry.Maui.Tests/Sentry.Maui.Tests.csproj" />
<Project Path="test/Sentry.MauiTrimTest/Sentry.MauiTrimTest.csproj" />
<Project Path="test/Sentry.NLog.Tests/Sentry.NLog.Tests.csproj" />
<Project Path="test/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj" />
<Project Path="test/Sentry.OpenTelemetry.Tests/Sentry.OpenTelemetry.Tests.csproj" />
<Project Path="test/Sentry.Profiling.Tests/Sentry.Profiling.Tests.csproj" />
<Project Path="test/Sentry.Serilog.Tests/Sentry.Serilog.Tests.csproj" />
Expand Down
2 changes: 2 additions & 0 deletions SentryNoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"src\\Sentry.Hangfire\\Sentry.Hangfire.csproj",
"src\\Sentry.Log4Net\\Sentry.Log4Net.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -68,6 +69,7 @@
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
2 changes: 2 additions & 0 deletions SentryNoSamples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"src\\Sentry.Maui.CommunityToolkit.Mvvm\\Sentry.Maui.CommunityToolkit.Mvvm.csproj",
"src\\Sentry.Maui\\Sentry.Maui.csproj",
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
Expand All @@ -44,6 +45,7 @@
"test\\Sentry.Maui.CommunityToolkit.Mvvm.Tests\\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
"test\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests\\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj",
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.14.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.14.0" />
<PackageReference Include="OpenTelemetry" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="7.6.0" />
<PackageReference Include="GraphQL.Server.Ui.Altair" Version="7.6.0" />
<PackageReference Include="GraphQL.SystemTextJson" Version="7.6.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
</ItemGroup>

Expand Down
23 changes: 14 additions & 9 deletions samples/Sentry.Samples.OpenTelemetry.AspNetCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using Sentry.OpenTelemetry;
using Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol;
using Sentry.Samples.OpenTelemetry.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

#if SENTRY_DSN_DEFINED_IN_ENV
var dsn = Environment.GetEnvironmentVariable("SENTRY_DSN")
?? throw new InvalidOperationException("SENTRY_DSN environment variable is not set");
#else
// 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/
var dsn = SamplesShared.Dsn;
#endif

// OpenTelemetry Configuration
// See https://opentelemetry.io/docs/instrumentation/net/getting-started/
builder.Services.AddOpenTelemetry()
Expand All @@ -20,22 +30,17 @@
// The two lines below take care of configuring sources for ASP.NET Core and HttpClient
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
// Finally we configure OpenTelemetry to send traces to Sentry
.AddSentry()
// Finally, we configure OpenTelemetry over OTLP to send traces to Sentry
.AddSentryOtlp(dsn)
);

builder.WebHost.UseSentry(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.Dsn = dsn;
options.Debug = builder.Environment.IsDevelopment();
options.SendDefaultPii = true;
options.TracesSampleRate = 1.0;
options.UseOpenTelemetry(); // <-- Configure Sentry to use OpenTelemetry trace information
options.UseOtlp(); // <-- Configure Sentry to use OpenTelemetry trace information
});

builder.Services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.8.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.0" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand All @@ -20,9 +21,10 @@
<SentryUploadSources>true</SentryUploadSources>
</PropertyGroup>

<!-- In your own project, this would be PackageReferences to the latest versions of these Sentry packages. -->
<ItemGroup>
<ProjectReference Include="..\..\src\Sentry.AspNetCore\Sentry.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Sentry.OpenTelemetry\Sentry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\src\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
</ItemGroup>

</Project>
19 changes: 13 additions & 6 deletions samples/Sentry.Samples.OpenTelemetry.AzureFunctions/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
using Microsoft.Extensions.Logging;
using OpenTelemetry.Trace;
using Sentry.OpenTelemetry;
using Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol;

#if SENTRY_DSN_DEFINED_IN_ENV
var dsn = Environment.GetEnvironmentVariable("SENTRY_DSN")
?? throw new InvalidOperationException("SENTRY_DSN environment variable is not set");
#else
// 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/
var dsn = SamplesShared.Dsn;
#endif

var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
Expand All @@ -11,20 +21,17 @@
services.AddOpenTelemetry().WithTracing(builder =>
{
builder
.AddSentry() // <-- Configure OpenTelemetry to send traces to Sentry
.AddSentryOtlp(dsn) // <-- Configure OpenTelemetry to send traces to Sentry
.AddHttpClientInstrumentation(); // From OpenTelemetry.Instrumentation.Http... adds automatic tracing for outgoing HTTP requests
});
})
.ConfigureLogging(logging =>
{
logging.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.
options.Dsn = SamplesShared.Dsn;
#endif
options.Dsn = dsn;
options.TracesSampleRate = 1.0;
options.UseOpenTelemetry(); // <-- Configure Sentry to use open telemetry
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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.7" />
<PackageReference Include="OpenTelemetry" Version="1.14.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.14.0" />
<PackageReference Include="OpenTelemetry" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -31,9 +31,9 @@
<SentryUploadSources>true</SentryUploadSources>
</PropertyGroup>

<!-- In your own project, this would be PackageReferences to the latest versions of these Sentry packages. -->
<ItemGroup>
<!-- TODO: Replace with a package reference -->
<ProjectReference Include="..\..\src\Sentry.Extensions.Logging\Sentry.Extensions.Logging.csproj" />
<ProjectReference Include="..\..\src\Sentry.OpenTelemetry\Sentry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\src\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol\Sentry.OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
</ItemGroup>
</Project>
Loading
Loading