Skip to content

Commit

Permalink
Updates for preview 5
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennanConroy committed Apr 15, 2024
1 parent dae02f0 commit afd500c
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 79 deletions.
10 changes: 6 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<PackageVersion Include="Aspire.Hosting.RabbitMQ" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Redis" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Azure" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Azure.ApplicationInsights" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Hosting.Azure.ServiceBus" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Npgsql" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.StackExchange.Redis" Version="$(AspireVersion)" />
Expand Down Expand Up @@ -54,9 +56,9 @@
<!-- Open Telemetry -->
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.8.0" />
<!-- VS Test -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
Expand All @@ -67,9 +69,9 @@
<PackageVersion Include="Grpc.AspNetCore.Server.ClientFactory" Version="$(GrpcVersion)" />
<PackageVersion Include="Grpc.Tools" Version="$(GrpcVersion)" PrivateAssets="All" />
<!-- Azure -->
<PackageVersion Include="AspNetCore.HealthChecks.AzureServiceBus" Version="7.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.AzureServiceBus" Version="8.0.0" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.0.0-beta.8" />
<PackageVersion Include="Microsoft.Identity.Web" Version="2.15.3" />
<PackageVersion Include="Microsoft.Identity.Web" Version="2.17.4" />
<!-- Miscellaneous -->
<PackageVersion Include="Automapper" Version="13.0.1" />
<PackageVersion Include="Dapper" Version="2.1.35" />
Expand Down
1 change: 0 additions & 1 deletion eShop.Web.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"solution": {
"path": "eShop.sln",
"projects": [
"src\\AzureServices\\AzureServices.csproj",
"src\\Basket.API\\Basket.API.csproj",
"src\\Catalog.API\\Catalog.API.csproj",
"src\\EventBusServiceBus\\EventBusServiceBus.csproj",
Expand Down
7 changes: 0 additions & 7 deletions eShop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.FunctionalTests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.UnitTests", "tests\Ordering.UnitTests\Ordering.UnitTests.csproj", "{6B3179A3-A527-4CEB-B505-5C53A3B45D4D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureServices", "src\AzureServices\AzureServices.csproj", "{8CF7D96D-20B3-4EB0-93B0-490123136AB5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBusServiceBus", "src\EventBusServiceBus\EventBusServiceBus.csproj", "{894CAE67-509D-41C1-A8B3-2C5F8D6CBED3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAppComponents", "src\WebAppComponents\WebAppComponents.csproj", "{0186D030-94C7-446B-A2F7-6E482CC9DEBC}"
Expand Down Expand Up @@ -147,10 +145,6 @@ Global
{6B3179A3-A527-4CEB-B505-5C53A3B45D4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B3179A3-A527-4CEB-B505-5C53A3B45D4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B3179A3-A527-4CEB-B505-5C53A3B45D4D}.Release|Any CPU.Build.0 = Release|Any CPU
{8CF7D96D-20B3-4EB0-93B0-490123136AB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CF7D96D-20B3-4EB0-93B0-490123136AB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CF7D96D-20B3-4EB0-93B0-490123136AB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CF7D96D-20B3-4EB0-93B0-490123136AB5}.Release|Any CPU.Build.0 = Release|Any CPU
{894CAE67-509D-41C1-A8B3-2C5F8D6CBED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{894CAE67-509D-41C1-A8B3-2C5F8D6CBED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{894CAE67-509D-41C1-A8B3-2C5F8D6CBED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -199,7 +193,6 @@ Global
{B53CD61E-60F2-468A-8748-976B8E85D7FA} = {A857AD10-40FF-4303-BEC2-FF1C58D5735E}
{341A5676-0D65-47D5-A483-99511E4C6C65} = {A857AD10-40FF-4303-BEC2-FF1C58D5735E}
{6B3179A3-A527-4CEB-B505-5C53A3B45D4D} = {A857AD10-40FF-4303-BEC2-FF1C58D5735E}
{8CF7D96D-20B3-4EB0-93B0-490123136AB5} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{894CAE67-509D-41C1-A8B3-2C5F8D6CBED3} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{0186D030-94C7-446B-A2F7-6E482CC9DEBC} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{66275483-5364-42F9-B7E6-410E6A1B5ECF} = {932D8224-11F6-4D07-B109-DA28AD288A63}
Expand Down
24 changes: 0 additions & 24 deletions src/AzureServices/AppInsightsBuilderExtensions.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/AzureServices/AppInsightsResource.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/AzureServices/AzureServices.csproj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static IEventBusBuilder AddServiceBusEventBus(this IHostApplicationBuilde
{
ArgumentNullException.ThrowIfNull(builder);

builder.AddAzureServiceBus(connectionName, o =>
builder.AddAzureServiceBusClient(connectionName, o =>
{
o.Tracing = true;
o.HealthCheckTopicName = "eshop_event_bus";
Expand Down
18 changes: 13 additions & 5 deletions src/eShop.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
using eShop.AppHost;

using Aspire.Hosting;
using eShop.AppHost;
using Microsoft.Extensions.Configuration;

var builder = DistributedApplication.CreateBuilder(args);

builder.AddForwardedHeaders();

var appInsights = builder.AddApplicationInsights("appInsights");
var appInsights = builder.ExecutionContext.IsPublishMode
? builder.AddAzureApplicationInsights("appInsights")
: builder.AddConnectionString("appInsights", "APPLICATIONINSIGHTS_CONNECTION_STRING");

var redis = builder.AddRedis("redis");
var serviceBus = builder.AddAzureServiceBus("eventBus", topicNames: ["eshop_event_bus"]);

var serviceBus = builder.ExecutionContext.IsPublishMode
? builder.AddAzureServiceBus("eventBus").AddTopic("eshop_event_bus")
: builder.AddConnectionString("eventBus");

var postgres = builder.AddPostgres("postgres")
.WithImage("ankane/pgvector")
.WithImageTag("latest");
Expand Down Expand Up @@ -66,8 +75,7 @@
.WithReference(catalogApi)
.WithReference(orderingApi)
.WithReference(serviceBus)
.WithReference(appInsights)
.WithLaunchProfile("https");
.WithReference(appInsights);

// set to true if you want to use OpenAI
bool useOpenAI = false;
Expand Down
3 changes: 2 additions & 1 deletion src/eShop.AppHost/eShop.AppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
<PackageReference Include="Aspire.Hosting.PostgreSQL" />
<PackageReference Include="Aspire.Hosting.Azure.CognitiveServices" />
<PackageReference Include="Aspire.Hosting.Azure" />
<PackageReference Include="Aspire.Hosting.Azure.ApplicationInsights" />
<PackageReference Include="Aspire.Hosting.Azure.ServiceBus" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AzureServices\AzureServices.csproj" />
<ProjectReference Include="..\Mobile.Bff.Shopping\Mobile.Bff.Shopping.csproj" />
<ProjectReference Include="..\Basket.API\Basket.API.csproj" />
<ProjectReference Include="..\Catalog.API\Catalog.API.csproj" />
Expand Down
10 changes: 2 additions & 8 deletions src/eShop.ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,9 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddOtlpExporter());
}

if (builder.Configuration.GetConnectionString("AppInsights") is string connectionString)
if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
{
if (!string.IsNullOrEmpty(connectionString))
{
openTelemetry.UseAzureMonitor(o =>
{
o.ConnectionString = connectionString;
});
}
builder.Services.AddOpenTelemetry().UseAzureMonitor();
}

return builder;
Expand Down

0 comments on commit afd500c

Please sign in to comment.