Skip to content

Commit

Permalink
Merge pull request #16 from 0xcryptar/cry-49-add-sentry-to-every-service
Browse files Browse the repository at this point in the history
CRY-49 | Added Sentry
  • Loading branch information
skolumban-ex authored Dec 11, 2024
2 parents 816c320 + e2e78e9 commit e539716
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ObjectHashServer.API/ObjectHashServer.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Content Include="local.settings.json" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
Expand All @@ -15,6 +18,7 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenApi" Version="1.5.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
<PackageReference Include="Sentry" Version="4.13.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ObjectHashServer.BLL\ObjectHashServer.BLL.csproj" />
Expand Down
18 changes: 18 additions & 0 deletions ObjectHashServer.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using Sentry;

var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
Expand All @@ -26,4 +27,21 @@
})
.Build();

SentrySdk.Init(options =>
{
// A Sentry Data Source Name (DSN) is required.
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
// You can set it in the SENTRY_DSN environment variable, or you can set it in code here.
options.Dsn = "https://a15d97557f84d25bfbb417eef0bec23f@o4508133068963840.ingest.de.sentry.io/4508439116513360";

// When debug is enabled, the Sentry client will emit detailed debugging information to the console.
// This might be helpful, or might interfere with the normal operation of your application.
// We enable it here for demonstration purposes when first trying Sentry.
// You shouldn't do this in your applications unless you're troubleshooting issues with Sentry.
options.Debug = true;

// This option is recommended. It enables Sentry's "Release Health" feature.
options.AutoSessionTracking = true;
});

host.Run();

0 comments on commit e539716

Please sign in to comment.