mirror of
https://github.com/fiodarsazanavets/aspire-13-examples.git
synced 2026-06-20 12:23:14 +00:00
Merge pull request #2 from srihari-sridharan/main
Fixed vulnerable assemblies.
This commit is contained in:
@@ -416,3 +416,5 @@ FodyWeavers.xsd
|
|||||||
*.msix
|
*.msix
|
||||||
*.msm
|
*.msm
|
||||||
*.msp
|
*.msp
|
||||||
|
**/.idea/
|
||||||
|
**/.DS_Store
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using OnlineShop.ServiceDefaults;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add service defaults & Aspire client integrations.
|
// Add service defaults & Aspire client integrations.
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.ServiceDiscovery;
|
|
||||||
using OpenTelemetry;
|
using OpenTelemetry;
|
||||||
using OpenTelemetry.Metrics;
|
using OpenTelemetry.Metrics;
|
||||||
using OpenTelemetry.Trace;
|
using OpenTelemetry.Trace;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.Hosting;
|
namespace OnlineShop.ServiceDefaults;
|
||||||
|
|
||||||
// Adds common Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
|
// Adds common Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
|
||||||
// This project should be referenced by each service project in your solution.
|
// This project should be referenced by each service project in your solution.
|
||||||
@@ -44,7 +44,7 @@ public static class Extensions
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
private static void ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
{
|
{
|
||||||
builder.Logging.AddOpenTelemetry(logging =>
|
builder.Logging.AddOpenTelemetry(logging =>
|
||||||
{
|
{
|
||||||
@@ -59,12 +59,12 @@ public static class Extensions
|
|||||||
.AddHttpClientInstrumentation()
|
.AddHttpClientInstrumentation()
|
||||||
.AddRuntimeInstrumentation();
|
.AddRuntimeInstrumentation();
|
||||||
})
|
})
|
||||||
.WithTracing(tracing =>
|
.WithTracing(tracerProviderBuilder =>
|
||||||
{
|
{
|
||||||
tracing.AddSource(builder.Environment.ApplicationName)
|
tracerProviderBuilder.AddSource(builder.Environment.ApplicationName)
|
||||||
.AddAspNetCoreInstrumentation(tracing =>
|
.AddAspNetCoreInstrumentation(traceInstrumentationOptions =>
|
||||||
// Exclude health check requests from tracing
|
// Exclude health check requests from tracing
|
||||||
tracing.Filter = context =>
|
traceInstrumentationOptions.Filter = context =>
|
||||||
!context.Request.Path.StartsWithSegments(HealthEndpointPath)
|
!context.Request.Path.StartsWithSegments(HealthEndpointPath)
|
||||||
&& !context.Request.Path.StartsWithSegments(AlivenessEndpointPath)
|
&& !context.Request.Path.StartsWithSegments(AlivenessEndpointPath)
|
||||||
)
|
)
|
||||||
@@ -74,11 +74,9 @@ public static class Extensions
|
|||||||
});
|
});
|
||||||
|
|
||||||
builder.AddOpenTelemetryExporters();
|
builder.AddOpenTelemetryExporters();
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
private static void AddOpenTelemetryExporters<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
{
|
{
|
||||||
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
|
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
|
||||||
|
|
||||||
@@ -93,17 +91,13 @@ public static class Extensions
|
|||||||
// builder.Services.AddOpenTelemetry()
|
// builder.Services.AddOpenTelemetry()
|
||||||
// .UseAzureMonitor();
|
// .UseAzureMonitor();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TBuilder AddDefaultHealthChecks<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
private static void AddDefaultHealthChecks<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
{
|
{
|
||||||
builder.Services.AddHealthChecks()
|
builder.Services.AddHealthChecks()
|
||||||
// Add a default liveness check to ensure app is responsive
|
// Add a default liveness check to ensure app is responsive
|
||||||
.AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);
|
.AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WebApplication MapDefaultEndpoints(this WebApplication app)
|
public static WebApplication MapDefaultEndpoints(this WebApplication app)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="10.0.0" />
|
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="10.0.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3" />
|
||||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.13.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.13.0" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.13.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.13.0" />
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using OnlineShop.ServiceDefaults;
|
||||||
using OnlineShop.Web;
|
using OnlineShop.Web;
|
||||||
using OnlineShop.Web.Components;
|
using OnlineShop.Web.Components;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user