Skip to content

Commit

Permalink
broken
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Sep 11, 2024
1 parent 56e0b1a commit 9572d55
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"cSpell.words": [
"ASPNETCORE",
"Bson",
"Bugsnag",
"hmac",
"HMACSHA",
"inferencing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\ServiceToolkit\src\SIL.ServiceToolkit\SIL.ServiceToolkit.csproj" />
<ProjectReference Include="..\..\..\Serval\src\Serval.Grpc\Serval.Grpc.csproj" />
</ItemGroup>

Expand Down
2 changes: 2 additions & 0 deletions src/Echo/src/EchoTranslationEngine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

builder.Services.AddHealthChecks().AddCheck("Live", () => HealthCheckResult.Healthy());

builder.Services.AddBugSnag(builder.Configuration);

WebApplication app = builder.Build();

// Configure the HTTP request pipeline.
Expand Down
2 changes: 2 additions & 0 deletions src/Machine/src/Serval.Machine.EngineServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
});
}

builder.Services.AddBugSnag(builder.Configuration);

var app = builder.Build();

app.UseHttpsRedirection();
Expand Down
2 changes: 2 additions & 0 deletions src/Machine/src/Serval.Machine.JobServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
});
}

builder.Services.AddBugSnag(builder.Configuration);

var app = builder.Build();

app.Run();
1 change: 1 addition & 0 deletions src/Serval/src/Serval.ApiServer/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public void ConfigureServices(IServiceCollection services)
.AddOpenTelemetry()
.WithMetrics(opts => opts.AddAspNetCoreInstrumentation().AddPrometheusExporter());
}
services.AddBugSnag(Configuration);
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace SIL.ServiceToolkit.Services;

public class BugSnagOptions
{
public const string Key = "BugSnag";

public string ApiKey { get; set; } = "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Bugsnag.AspNet.Core;
using Microsoft.Extensions.Configuration;
using SIL.ServiceToolkit.Services;

namespace Microsoft.Extensions.DependencyInjection;

public static class IServiceCollectionExtensions
{
public static IServiceCollection AddBugSnag(this IServiceCollection services, IConfiguration? configuration = null)
{
var apiKey = configuration?.GetSection(BugSnagOptions.Key)?.GetValue<string>("ApiKey");
if (apiKey is null)
{
Console.WriteLine("BugSnag ApiKey not available - not adding BugSnag.");
}
else
{
services.AddBugsnag(configuration =>
{
configuration.ApiKey = apiKey;
});
}
return services;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bugsnag.AspNet.Core" Version="3.1.0" />
<PackageReference Include="Grpc.Core.Api" Version="2.65.0" />
<PackageReference Include="Hangfire.Core" Version="1.8.14" />
<PackageReference Include="SIL.WritingSystems" Version="14.1.1" />
Expand Down

0 comments on commit 9572d55

Please sign in to comment.