mirror of
https://github.com/fiodarsazanavets/aspire-13-examples.git
synced 2026-06-20 12:23:14 +00:00
Refactoring for readability
This commit is contained in:
@@ -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.
|
||||||
@@ -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)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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