Changes
This commit is contained in:
@@ -3,11 +3,7 @@ using Musify.Infrastructure.MassTransit;
|
||||
using Musify.Infrastructure.Persistence;
|
||||
using Musify.Application.Configuration;
|
||||
using Musify.Infrastructure.Services;
|
||||
using OpenTelemetry.Logs;
|
||||
using OpenTelemetry.Metrics;
|
||||
using OpenTelemetry.Trace;
|
||||
using WebApi.DataTransferObjects.PlayLists;
|
||||
using WebApi.Options;
|
||||
|
||||
namespace WebApi.Extensions;
|
||||
|
||||
@@ -28,27 +24,4 @@ public static class ServiceCollectionExtensions
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddObservability(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var otlpEndpoint = new Uri(configuration
|
||||
.GetRequiredSection(OpenTelemetryOptions.SectionName)
|
||||
.GetRequiredSection(nameof(OpenTelemetryOptions.OtlpEndpoint))
|
||||
.Value!);
|
||||
|
||||
services.AddOpenTelemetry()
|
||||
.WithTracing(tracing => tracing
|
||||
.AddAspNetCoreInstrumentation()
|
||||
.AddHttpClientInstrumentation()
|
||||
.AddOtlpExporter(o => o.Endpoint = otlpEndpoint))
|
||||
.WithMetrics(metrics => metrics
|
||||
.AddAspNetCoreInstrumentation()
|
||||
.AddHttpClientInstrumentation()
|
||||
.AddOtlpExporter(o => o.Endpoint = otlpEndpoint));
|
||||
|
||||
services.Configure<OpenTelemetryLoggerOptions>(logging =>
|
||||
logging.AddOtlpExporter(o => o.Endpoint = otlpEndpoint));
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WebApi.Options;
|
||||
|
||||
public sealed class OpenTelemetryOptions
|
||||
{
|
||||
public const string SectionName = "OpenTelemetry";
|
||||
|
||||
[Required]
|
||||
public string OtlpEndpoint { get; init; } = string.Empty;
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
using Musify.Infrastructure.Observability;
|
||||
using Scalar.AspNetCore;
|
||||
using WebApi.Endpoints;
|
||||
using WebApi.Extensions;
|
||||
@@ -6,7 +7,7 @@ var builder = WebApplication.CreateBuilder();
|
||||
|
||||
builder.Services
|
||||
.AddApplicationServices(builder.Configuration)
|
||||
.AddObservability(builder.Configuration);
|
||||
.AddInfrastructureOpenTelemetry(builder.Configuration);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
+7
-12
@@ -11,12 +11,13 @@
|
||||
<PackageReference Include="Ardalis.Result" Version="10.1.0" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="4.0.23.4" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.1.1" />
|
||||
<PackageReference Include="MassTransit" Version="9.0.1" />
|
||||
<PackageReference Include="MassTransit.EntityFrameworkCore" Version="9.0.1" />
|
||||
<PackageReference Include="MassTransit.RabbitMQ" Version="9.0.1" />
|
||||
<PackageReference Include="MassTransit" Version="8.5.9" />
|
||||
<PackageReference Include="MassTransit.EntityFrameworkCore" Version="8.5.9" />
|
||||
<PackageReference Include="MassTransit.RabbitMQ" Version="8.5.9" />
|
||||
<PackageReference Include="Mediator.Abstractions" Version="3.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.8" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2" />
|
||||
<PackageReference Include="OpenTelemetry" Version="1.15.3" />
|
||||
<PackageReference Include="OpenTelemetry.Api" Version="1.15.3" />
|
||||
@@ -31,15 +32,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Application">
|
||||
<HintPath>..\..\MusifyBackend\Infrastructure\bin\Debug\net10.0\Application.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Domain">
|
||||
<HintPath>..\..\MusifyBackend\Infrastructure\bin\Debug\net10.0\Domain.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Infrastructure">
|
||||
<HintPath>..\..\MusifyBackend\Infrastructure\bin\Debug\net10.0\Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<ProjectReference Include="..\..\MusifyBackend\Application\Application.csproj" />
|
||||
<ProjectReference Include="..\..\MusifyBackend\Domain\Domain.csproj" />
|
||||
<ProjectReference Include="..\..\MusifyBackend\Infrastructure\Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user