Skip to content

Commit

Permalink
Setup AppInsights (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMacocian authored Nov 28, 2023
1 parent b9b9f9a commit 53fa62c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
$content = $content.Replace("[APIKEY]", "${{ secrets.APIKEY }}")
$content = $content.Replace("[AZURE_TABLESTORAGE_CONNECTIONSTRING]", "${{ secrets.AZURE_TABLESTORAGE_CONNECTIONSTRING }}")
$content = $content.Replace("[CERTIFICATE_BASE64]", "${{ secrets.CERTIFICATE_BASE64 }}")
$content = $content.Replace("[AZURE_INSIGHTS_INSTRUMENTATIONKEY]", "${{ secrets.AZURE_INSIGHTS_INSTRUMENTATIONKEY }}")
Set-Content -Path Config.Release.json -Value $content
Write-Host "Placeholder replaced successfully in Config.Release.json"
Expand Down
8 changes: 8 additions & 0 deletions GuildWarsPartySearch/Config.Debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"Default": "Debug",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information"
}
}
},
"EnvironmentOptions": {
Expand All @@ -46,5 +51,8 @@
"ContainerName": "content",
"UpdateFrequency": "0:5:0",
"StagingFolder": "Content"
},
"ApplicationInsights": {
"InstrumentationKey": "[AZURE_INSIGHTS_INSTRUMENTATIONKEY]"
}
}
10 changes: 9 additions & 1 deletion GuildWarsPartySearch/Config.Release.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Default": "Debug",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information"
}
}
},
"EnvironmentOptions": {
Expand All @@ -46,5 +51,8 @@
"ContainerName": "content",
"UpdateFrequency": "0:1:0",
"StagingFolder": "Content"
},
"ApplicationInsights": {
"InstrumentationKey": "[AZURE_INSIGHTS_INSTRUMENTATIONKEY]"
}
}
4 changes: 4 additions & 0 deletions GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="Azure.Data.Tables" Version="12.8.2" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.5.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="SystemExtensions.NetCore" Version="1.0.1" />
Expand Down
2 changes: 2 additions & 0 deletions GuildWarsPartySearch/Launch/ServerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static ILoggingBuilder SetupLogging(this ILoggingBuilder builder)
{
builder.ThrowIfNull()
.ClearProviders()
.AddApplicationInsights()
.AddConsole();

return builder;
Expand All @@ -77,6 +78,7 @@ public static IServiceCollection SetupServices(this IServiceCollection services)
{
services.ThrowIfNull();

services.AddApplicationInsightsTelemetry();
services.AddMemoryCache();
services.AddInMemoryRateLimiting();
services.AddScoped<ApiKeyProtected>();
Expand Down
2 changes: 1 addition & 1 deletion GuildWarsPartySearch/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:57442;http://localhost:57443"
"applicationUrl": "https://localhost:443;http://localhost:80"
}
}
}

0 comments on commit 53fa62c

Please sign in to comment.