![]() |
VOOZH | about |
dotnet add package AlefCarlos.AspNetCoreDefaults --version 1.1.5
NuGet\Install-Package AlefCarlos.AspNetCoreDefaults -Version 1.1.5
<PackageReference Include="AlefCarlos.AspNetCoreDefaults" Version="1.1.5" />
<PackageVersion Include="AlefCarlos.AspNetCoreDefaults" Version="1.1.5" />Directory.Packages.props
<PackageReference Include="AlefCarlos.AspNetCoreDefaults" />Project file
paket add AlefCarlos.AspNetCoreDefaults --version 1.1.5
#r "nuget: AlefCarlos.AspNetCoreDefaults, 1.1.5"
#:package AlefCarlos.AspNetCoreDefaults@1.1.5
#addin nuget:?package=AlefCarlos.AspNetCoreDefaults&version=1.1.5Install as a Cake Addin
#tool nuget:?package=AlefCarlos.AspNetCoreDefaults&version=1.1.5Install as a Cake Tool
Biblioteca base de convenções e extensões para aplicações ASP.NET Core focadas em Web APIs e serviços: oferece defaults opinativos para telemetria, logging HTTP, health checks, service discovery e configurações de HttpClient.
Fornecer um conjunto pequeno e reutilizável de padrões para serviços, permitindo que equipes iniciem novas APIs com observabilidade, resiliência e endpoints operacionais configurados de forma consistente.
Baseadas no arquivo de projeto (AlefCarlos.AspNetCoreDefaults.csproj):
Microsoft.Extensions.AmbientMetadata.Application (ApplicationMetadata)Microsoft.Extensions.Http.Resilience (resiliência de HttpClient)Microsoft.Extensions.ServiceDiscovery (service discovery)OpenTelemetry.Extensions.Hosting, OpenTelemetry.Instrumentation.*, OpenTelemetry.Exporter.OpenTelemetryProtocol (telemetria)TBuilder AddDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
ApplicationMetadata (bind em ambientmetadata:application, validação em start)AddHttpLoggingDefaults(), ConfigureOpenTelemetry(), AddDefaultHealthChecks() e registra service discoveryHttpClient (resiliência e service discovery)TBuilder AddHttpLoggingDefaults<TBuilder>(this TBuilder builder)
HttpLogging com RequestPropertiesAndHeaders | ResponsePropertiesAndHeaders | DurationCombineLogs = trueFilterRequestLoggingInterceptor como IHttpLoggingInterceptorTBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder)
/health e /alive) de tracingOTEL_EXPORTER_OTLP_ENDPOINT seja definidoTBuilder AddDefaultHealthChecks<TBuilder>(this TBuilder builder)
self marcado com tag live (garante liveness básico)WebApplication MapDefaultEndpoints(this WebApplication app)
/health (readiness — todos checks)/alive (liveness — apenas checks taggeados com live)/app-info que retorna ApplicationMetadata (excluído da documentação do OpenAPI via ExcludeFromDescription())ApplicationMetadata
AddOptionsWithValidateOnStart<ApplicationMetadata>() e BindConfiguration("ambientmetadata:application").BuildVersion é inferido de AssemblyInformationalVersion → Assembly.Version → fallback 0.1.0+unknown-app.OTEL_SERVICE_NAME estiver definido, sobrescreve ApplicationName usado pela instrumentação.EnvironmentName é definido a partir de IHostEnvironment.EnvironmentName.OpenTelemetry
OTEL_EXPORTER_OTLP_ENDPOINT estiver presente, registra o exporter OTLP automaticamenteHttpLogging e interceptor
FilterRequestLoggingInterceptor remove logging (HttpLoggingFields.None) para endpoints comuns sensíveis/ruidosos: /metrics, /env, /health, /alive, /docs, /swagger.CombineLogs = true ativa logs combinados por request/responseHttpClient defaults
AddStandardResilienceHandler) e integração com service discovery (AddServiceDiscovery).var builder = WebApplication.CreateBuilder(args);
// Registra defaults opinativos (telemetria, logging, health checks, service discovery)
builder.AddDefaults();
var app = builder.Build();
// Use o middleware de logging HTTP conforme necessário
app.UseHttpLogging();
// Mapear endpoints operacionais
app.MapDefaultEndpoints();
app.Run();
OTEL_SERVICE_NAME — (opcional) define o nome do serviço para OpenTelemetryOTEL_EXPORTER_OTLP_ENDPOINT — (opcional) se definido, habilita o OTLP exporterambientmetadata:application pode fornecer ApplicationName, BuildVersion, etc./app-info protegida em ambientes públicos se retornar dados sensíveis.HttpLogging por ambiente e níveis de log para evitar vazamento de dados em produção.AddDefaults() em sua aplicação para inserir checks, middlewares ou exportadores adicionais.samples/webapi-default.cs para uso integrado com AddWebApiDefaults() (apenas um nível acima, mas demonstra AddDefaults() em ação).| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on AlefCarlos.AspNetCoreDefaults:
| Package | Downloads |
|---|---|
|
AlefCarlos.AspNetCoreDefaults.WebApi
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.5 | 152 | 6/2/2026 |
| 1.1.4 | 125 | 6/1/2026 |
| 1.1.3 | 125 | 5/31/2026 |
| 1.1.2 | 139 | 5/29/2026 |
| 1.1.1 | 123 | 5/28/2026 |
| 1.1.0 | 133 | 5/28/2026 |
| 1.0.4 | 148 | 5/21/2026 |
| 1.0.3 | 142 | 4/25/2026 |
| 1.0.2 | 123 | 4/16/2026 |
| 1.0.1 | 213 | 12/26/2025 |
| 1.0.0 | 209 | 12/24/2025 |
| 0.0.1-rc8 | 212 | 12/24/2025 |
| 0.0.1-rc7 | 211 | 12/24/2025 |
| 0.0.1-rc6 | 217 | 12/24/2025 |