Skip to content

Commit

Permalink
added azure application insights option (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-tspencer authored Apr 12, 2022
1 parent e21a9b9 commit ca564a6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Steamfitter.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add Azure Application Insights, if connection string is supplied
string appInsights = Configuration["ApplicationInsights:ConnectionString"];
if (!string.IsNullOrWhiteSpace(appInsights))
{
services.AddApplicationInsightsTelemetry();
}

services.AddSingleton<TaskMaintenanceServiceHealthCheck>();
services.AddSingleton<StartupHealthCheck>();
services.AddHealthChecks()
Expand Down
1 change: 1 addition & 0 deletions Steamfitter.Api/Steamfitter.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3"/>
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.2.3"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1"/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 3 additions & 0 deletions Steamfitter.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
"ExpirationCheckSeconds": 30,
"ApiParameters": {}
},
"ApplicationInsights": {
"ConnectionString": ""
},
"SeedData": {
"Permissions": [
{
Expand Down

0 comments on commit ca564a6

Please sign in to comment.