mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(svcs): ✨ add AppInsights
ref https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/application-insights
This commit is contained in:
parent
1c02e94bb3
commit
fe022068a6
4 changed files with 13 additions and 6 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.0.1"/>
|
||||
<PackageReference Include="Aspire.Hosting.Azure.ApplicationInsights" Version="8.0.1"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
var builder = DistributedApplication.CreateBuilder(args);
|
||||
|
||||
var directoryApi = builder.AddProject<FilterLists_ApiService>("directoryapi");
|
||||
var appInsights = builder.AddAzureApplicationInsights("appinsights");
|
||||
|
||||
var directoryApi = builder.AddProject<FilterLists_ApiService>("directoryapi")
|
||||
.WithReference(appInsights);
|
||||
|
||||
builder.AddProject<FilterLists_Web>("web")
|
||||
.WithReference(directoryApi)
|
||||
.WithReference(appInsights)
|
||||
.WithExternalHttpEndpoints();
|
||||
|
||||
builder.Build().Run();
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
using Azure.Monitor.OpenTelemetry.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -74,11 +75,11 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli
|
|||
}
|
||||
|
||||
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
|
||||
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
|
||||
//{
|
||||
// builder.Services.AddOpenTelemetry()
|
||||
// .UseAzureMonitor();
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
|
||||
{
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.UseAzureMonitor();
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
|
||||
|
||||
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.1.1"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.3.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.0.1"/>
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.1"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue