diff --git a/.vscode/settings.json b/.vscode/settings.json
index 9981ae9c..4c5aadb3 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -9,6 +9,7 @@
"cSpell.words": [
"ASPNETCORE",
"Bson",
+ "Bugsnag",
"hmac",
"HMACSHA",
"inferencing",
diff --git a/src/Echo/src/EchoTranslationEngine/EchoTranslationEngine.csproj b/src/Echo/src/EchoTranslationEngine/EchoTranslationEngine.csproj
index c0c575cf..f516c85c 100644
--- a/src/Echo/src/EchoTranslationEngine/EchoTranslationEngine.csproj
+++ b/src/Echo/src/EchoTranslationEngine/EchoTranslationEngine.csproj
@@ -18,6 +18,7 @@
+
diff --git a/src/Echo/src/EchoTranslationEngine/Program.cs b/src/Echo/src/EchoTranslationEngine/Program.cs
index a931cd7e..34e1bea9 100644
--- a/src/Echo/src/EchoTranslationEngine/Program.cs
+++ b/src/Echo/src/EchoTranslationEngine/Program.cs
@@ -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.
diff --git a/src/Machine/src/Serval.Machine.EngineServer/Program.cs b/src/Machine/src/Serval.Machine.EngineServer/Program.cs
index 029e03df..cbe75af4 100644
--- a/src/Machine/src/Serval.Machine.EngineServer/Program.cs
+++ b/src/Machine/src/Serval.Machine.EngineServer/Program.cs
@@ -29,6 +29,8 @@
});
}
+builder.Services.AddBugSnag(builder.Configuration);
+
var app = builder.Build();
app.UseHttpsRedirection();
diff --git a/src/Machine/src/Serval.Machine.JobServer/Program.cs b/src/Machine/src/Serval.Machine.JobServer/Program.cs
index d78bfed8..1062109f 100644
--- a/src/Machine/src/Serval.Machine.JobServer/Program.cs
+++ b/src/Machine/src/Serval.Machine.JobServer/Program.cs
@@ -25,6 +25,8 @@
});
}
+builder.Services.AddBugSnag(builder.Configuration);
+
var app = builder.Build();
app.Run();
diff --git a/src/Serval/src/Serval.ApiServer/Startup.cs b/src/Serval/src/Serval.ApiServer/Startup.cs
index 0831e75c..cd3ebb3c 100644
--- a/src/Serval/src/Serval.ApiServer/Startup.cs
+++ b/src/Serval/src/Serval.ApiServer/Startup.cs
@@ -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)
diff --git a/src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/BugsnagOptions.cs b/src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/BugsnagOptions.cs
new file mode 100644
index 00000000..e6030538
--- /dev/null
+++ b/src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/BugsnagOptions.cs
@@ -0,0 +1,8 @@
+namespace SIL.ServiceToolkit.Services;
+
+public class BugSnagOptions
+{
+ public const string Key = "BugSnag";
+
+ public string ApiKey { get; set; } = "";
+}
diff --git a/src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/IServiceCollectionExtensions.cs b/src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/IServiceCollectionExtensions.cs
new file mode 100644
index 00000000..f650a027
--- /dev/null
+++ b/src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/IServiceCollectionExtensions.cs
@@ -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("ApiKey");
+ if (apiKey is null)
+ {
+ Console.WriteLine("BugSnag ApiKey not available - not adding BugSnag.");
+ }
+ else
+ {
+ services.AddBugsnag(configuration =>
+ {
+ configuration.ApiKey = apiKey;
+ });
+ }
+ return services;
+ }
+}
diff --git a/src/ServiceToolkit/src/SIL.ServiceToolkit/SIL.ServiceToolkit.csproj b/src/ServiceToolkit/src/SIL.ServiceToolkit/SIL.ServiceToolkit.csproj
index b5cb78cd..a84edf58 100644
--- a/src/ServiceToolkit/src/SIL.ServiceToolkit/SIL.ServiceToolkit.csproj
+++ b/src/ServiceToolkit/src/SIL.ServiceToolkit/SIL.ServiceToolkit.csproj
@@ -11,6 +11,7 @@
+