Skip to content

Commit d7136db

Browse files
committed
Update Aspire
1 parent c378af0 commit d7136db

File tree

31 files changed

+110
-82
lines changed

31 files changed

+110
-82
lines changed

src/ProjectTemplates/GeneratedContent.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
Specifies external packages that get referenced in generated template content.
3434
-->
3535
<PropertyGroup>
36-
<TemplatePackageVersion_Aspire>9.4.0</TemplatePackageVersion_Aspire>
37-
<TemplatePackageVersion_Aspire_Preview>9.4.0-preview.1.25378.8</TemplatePackageVersion_Aspire_Preview>
38-
<TemplatePackageVersion_AzureAIOpenAI>2.3.0-beta.1</TemplatePackageVersion_AzureAIOpenAI>
36+
<TemplatePackageVersion_Aspire>9.5.0</TemplatePackageVersion_Aspire>
37+
<TemplatePackageVersion_Aspire_Preview>9.5.0-preview.1.25474.7</TemplatePackageVersion_Aspire_Preview>
38+
<TemplatePackageVersion_AzureAIOpenAI>2.3.0-beta.2</TemplatePackageVersion_AzureAIOpenAI>
3939
<TemplatePackageVersion_AzureAIProjects>1.0.0-beta.9</TemplatePackageVersion_AzureAIProjects>
4040
<TemplatePackageVersion_AzureIdentity>1.14.0</TemplatePackageVersion_AzureIdentity>
4141
<TemplatePackageVersion_AzureSearchDocuments>11.6.1</TemplatePackageVersion_AzureSearchDocuments>

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/.template.config/template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json.schemastore.org/template",
33
"author": "Microsoft",
4-
"classifications": [ "Common", "AI", "Web", "Blazor", ".NET Aspire" ],
4+
"classifications": [ "Common", "AI", "Web", "Blazor", "Aspire" ],
55
"identity": "Microsoft.Extensions.AI.Templates.WebChat.CSharp",
66
"name": "AI Chat Web App",
77
"description": "A project template for creating an AI chat application, which uses retrieval-augmented generation (RAG) to chat with your own data.",
@@ -177,7 +177,7 @@
177177
"displayName": "Use Aspire orchestration",
178178
"datatype": "bool",
179179
"defaultValue": "false",
180-
"description": "Create the project as a distributed application using .NET Aspire."
180+
"description": "Create the project as a distributed application using Aspire."
181181
},
182182
"IsAspire": {
183183
"type": "computed",

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.AppHost/ChatWithCustomData-CSharp.AppHost.csproj.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<TargetFramework>net9.0</TargetFramework>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
10-
<IsAspireHost>true</IsAspireHost>
1110
<UserSecretsId>b2f4f5e9-1083-472c-8c3b-f055ac67ba54</UserSecretsId>
1211
</PropertyGroup>
1312

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.AppHost/Properties/launchSettings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"environmentVariables": {
1010
"ASPNETCORE_ENVIRONMENT": "Development",
1111
"DOTNET_ENVIRONMENT": "Development",
12-
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21000",
13-
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22000"
12+
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21000",
13+
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22000"
1414
}
1515
},
1616
"http": {
@@ -21,8 +21,8 @@
2121
"environmentVariables": {
2222
"ASPNETCORE_ENVIRONMENT": "Development",
2323
"DOTNET_ENVIRONMENT": "Development",
24-
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19000",
25-
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20000"
24+
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19000",
25+
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20000"
2626
}
2727
}
2828
}

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.ServiceDefaults/Extensions.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010

1111
namespace Microsoft.Extensions.Hosting;
1212

13-
// Adds common .NET Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
13+
// Adds common Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
1414
// This project should be referenced by each service project in your solution.
1515
// To learn more about using this project, see https://aka.ms/dotnet/aspire/service-defaults
1616
public static class Extensions
1717
{
18+
private const string HealthEndpointPath = "/health";
19+
private const string AlivenessEndpointPath = "/alive";
20+
1821
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
1922
{
2023
builder.ConfigureOpenTelemetry();
@@ -77,7 +80,12 @@ public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) w
7780
.WithTracing(tracing =>
7881
{
7982
tracing.AddSource(builder.Environment.ApplicationName)
80-
.AddAspNetCoreInstrumentation()
83+
.AddAspNetCoreInstrumentation(tracing =>
84+
// Exclude health check requests from tracing
85+
tracing.Filter = context =>
86+
!context.Request.Path.StartsWithSegments(HealthEndpointPath)
87+
&& !context.Request.Path.StartsWithSegments(AlivenessEndpointPath)
88+
)
8189
// Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
8290
//.AddGrpcClientInstrumentation()
8391
.AddHttpClientInstrumentation()
@@ -124,10 +132,10 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)
124132
if (app.Environment.IsDevelopment())
125133
{
126134
// All health checks must pass for app to be considered ready to accept traffic after starting
127-
app.MapHealthChecks("/health");
135+
app.MapHealthChecks(HealthEndpointPath);
128136

129137
// Only health checks tagged with the "live" tag must pass for app to be considered alive
130-
app.MapHealthChecks("/alive", new HealthCheckOptions
138+
app.MapHealthChecks(AlivenessEndpointPath, new HealthCheckOptions
131139
{
132140
Predicate = r => r.Tags.Contains("live")
133141
});

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/Services/Ingestion/DataIngestor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public async Task IngestDataAsync(IIngestionSource source)
3131
var deletedDocuments = await source.GetDeletedDocumentsAsync(documentsForSource);
3232
foreach (var deletedDocument in deletedDocuments)
3333
{
34-
logger.LogInformation("Removing ingested data for {documentId}", deletedDocument.DocumentId);
34+
logger.LogInformation("Removing ingested data for {DocumentId}", deletedDocument.DocumentId);
3535
await DeleteChunksForDocumentAsync(deletedDocument);
3636
await documentsCollection.DeleteAsync(deletedDocument.Key);
3737
}
3838

3939
var modifiedDocuments = await source.GetNewOrModifiedDocumentsAsync(documentsForSource);
4040
foreach (var modifiedDocument in modifiedDocuments)
4141
{
42-
logger.LogInformation("Processing {documentId}", modifiedDocument.DocumentId);
42+
logger.LogInformation("Processing {DocumentId}", modifiedDocument.DocumentId);
4343
await DeleteChunksForDocumentAsync(modifiedDocument);
4444

4545
await documentsCollection.UpsertAsync(modifiedDocument);
@@ -54,7 +54,7 @@ async Task DeleteChunksForDocumentAsync(IngestedDocument document)
5454
{
5555
var documentId = document.DocumentId;
5656
var chunksToDelete = await chunksCollection.GetAsync(record => record.DocumentId == documentId, int.MaxValue).ToListAsync();
57-
if (chunksToDelete.Any())
57+
if (chunksToDelete.Count != 0)
5858
{
5959
await chunksCollection.DeleteAsync(chunksToDelete.Select(r => r.Key));
6060
}

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ Note: Qdrant and Docker are excellent open source products, but are not maintain
143143

144144
## Trust the localhost certificate
145145

146-
Several .NET Aspire templates include ASP.NET Core projects that are configured to use HTTPS by default. If this is the first time you're running the project, an exception might occur when loading the Aspire dashboard. This error can be resolved by trusting the self-signed development certificate with the .NET CLI.
146+
Several Aspire templates include ASP.NET Core projects that are configured to use HTTPS by default. If this is the first time you're running the project, an exception might occur when loading the Aspire dashboard. This error can be resolved by trusting the self-signed development certificate with the .NET CLI.
147147

148-
See [Troubleshoot untrusted localhost certificate in .NET Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information.
148+
See [Troubleshoot untrusted localhost certificate in Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information.
149149

150150
# Updating JavaScript dependencies
151151

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.AzureOpenAI_Qdrant_Aspire.verified/aichatweb/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ Make sure to replace placeholder values with real configuration values.
4747

4848
## Trust the localhost certificate
4949

50-
Several .NET Aspire templates include ASP.NET Core projects that are configured to use HTTPS by default. If this is the first time you're running the project, an exception might occur when loading the Aspire dashboard. This error can be resolved by trusting the self-signed development certificate with the .NET CLI.
50+
Several Aspire templates include ASP.NET Core projects that are configured to use HTTPS by default. If this is the first time you're running the project, an exception might occur when loading the Aspire dashboard. This error can be resolved by trusting the self-signed development certificate with the .NET CLI.
5151

52-
See [Troubleshoot untrusted localhost certificate in .NET Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information.
52+
See [Troubleshoot untrusted localhost certificate in Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information.
5353

5454
# Updating JavaScript dependencies
5555

0 commit comments

Comments
 (0)