Skip to content

Commit ab561f2

Browse files
Add AI
1 parent f72cadb commit ab561f2

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

backend/JobHelper.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11+
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
1112
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
1213
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
1314
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="9.0.10" />

backend/Program.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111

1212
var builder = WebApplication.CreateBuilder(args);
1313

14+
// Add Application Insights telemetry
15+
builder.Services.AddApplicationInsightsTelemetry(options =>
16+
{
17+
options.ConnectionString = builder.Configuration["ApplicationInsights:ConnectionString"];
18+
options.EnableAdaptiveSampling = true;
19+
options.EnableQuickPulseMetricStream = true;
20+
});
21+
1422
IConfigurationSection authConfiguration = builder.Configuration.GetSection("Authentication");
1523

1624
// Configure SQL Server Database

backend/appsettings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
"Microsoft.AspNetCore": "Warning",
66
"Microsoft.AspNetCore.Authentication": "Information",
77
"Microsoft.AspNetCore.Authorization": "Information"
8+
},
9+
"ApplicationInsights": {
10+
"LogLevel": {
11+
"Default": "Information",
12+
"Microsoft": "Warning"
13+
}
814
}
915
},
1016
"AllowedHosts": "*",
1117
"ConnectionStrings": {
1218
"DefaultConnection": "Server=tcp:your-server.database.windows.net,1433;Initial Catalog=jobhelper;Persist Security Info=False;User ID=your-username;Password=your-password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
1319
},
1420
"Authentication": {
15-
"Google": {
21+
"Google": {
1622
"ClientId": "id",
1723
"ClientSecret": "secret"
1824
}

0 commit comments

Comments
 (0)