ResQ.BuildingBlocks.ServiceDefaults
0.2.0
dotnet add package ResQ.BuildingBlocks.ServiceDefaults --version 0.2.0
NuGet\Install-Package ResQ.BuildingBlocks.ServiceDefaults -Version 0.2.0
<PackageReference Include="ResQ.BuildingBlocks.ServiceDefaults" Version="0.2.0" />
<PackageVersion Include="ResQ.BuildingBlocks.ServiceDefaults" Version="0.2.0" />
<PackageReference Include="ResQ.BuildingBlocks.ServiceDefaults" />
paket add ResQ.BuildingBlocks.ServiceDefaults --version 0.2.0
#r "nuget: ResQ.BuildingBlocks.ServiceDefaults, 0.2.0"
#:package ResQ.BuildingBlocks.ServiceDefaults@0.2.0
#addin nuget:?package=ResQ.BuildingBlocks.ServiceDefaults&version=0.2.0
#tool nuget:?package=ResQ.BuildingBlocks.ServiceDefaults&version=0.2.0
ResQ.BuildingBlocks.ServiceDefaults
Aspire-style cross-cutting defaults — one call from a host's composition root wires observability, health, resilience, and a testable clock. Depends only on ResQ.BuildingBlocks.Application + ResQ.BuildingBlocks.Domain.
What AddServiceDefaults wires
- OpenTelemetry (
ConfigureOpenTelemetry): logs (IncludeScopes+IncludeFormattedMessage), metrics (ASP.NET Core + HTTP-client + runtime instrumentation + theResqDiagnostics.MeterNamemeter), and traces (ASP.NET Core + HTTP-client sources + theResqDiagnostics.ActivitySourceNamesource). The OTLP exporter turns on only whenOTEL_EXPORTER_OTLP_ENDPOINTis set. - Health checks (
AddDefaultHealthChecks): aselfliveness check taggedlive. - Service discovery + standard HTTP resilience: applied to every
HttpClientviaConfigureHttpClientDefaults. IClock→ singletonSystemClock(backed byTimeProvider.System).
It does not register the observability pipeline behaviors — that is an explicit, ordered call (below).
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults(); // OTel / health / resilience / IClock — NO behaviors
builder.Services
.AddResqApplication(typeof(CreateWidget).Assembly)
.AddValidatorsFrom(typeof(CreateWidget).Assembly)
.AddLoggingPipeline() // outermost
.AddValidationPipeline();
builder.Services.AddResqObservabilityBehaviors(); // Tracing then Metrics — AFTER validation
var app = builder.Build();
app.MapDefaultEndpoints(); // /health + /alive (non-Production)
app.Run();
Resulting behavior order: Logging → Validation → Tracing → Metrics → Transaction → handler (first-registered = outermost).
Pieces
ServiceDefaultsExtensions—AddServiceDefaults,ConfigureOpenTelemetry,AddDefaultHealthChecks(IHostApplicationBuilder), andMapDefaultEndpoints(WebApplication).ResqDiagnostics— the sharedActivitySource+ theActivitySourceName/MeterNameconstants. No hand-newed staticMeter; metrics come fromIMeterFactoryso the emitting and allow-listed names always match.TracingBehavior<,>/MetricsBehavior<,>— CQRS pipeline behaviors. Tracing starts an activity named for the request and sets ok/error status (tags no business data); metrics record a duration histogram + failure counter, tagged by request name.AddResqObservabilityBehaviorsregisters both.AddResqOptions<T>(sectionName)— bind a config section,ValidateDataAnnotations, andValidateOnStart(fail fast at boot).AddResqResiliencePipeline(key, configure?)— a Polly retry + circuit-breaker + timeout pipeline whose retryShouldHandletreats a failedResultwithErrorType.Failure(or any exception) as retryable.
Known coupling (accepted)
FrameworkReference Microsoft.AspNetCore.App and AddAspNetCoreInstrumentation are unconditional, so a pure worker host that calls AddServiceDefaults still pulls the ASP.NET shared framework. This mirrors Aspire's own ServiceDefaults; a ServiceDefaults.Worker split is possible future work.
Apache-2.0 · part of resq-software/dotnet.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FluentValidation (>= 11.11.0)
- FluentValidation.DependencyInjectionExtensions (>= 11.11.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Http.Resilience (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.ServiceDiscovery (>= 9.0.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.17.0)
- Polly.Core (>= 8.5.0)
- ResQ.BuildingBlocks.Application (>= 0.2.0)
- ResQ.BuildingBlocks.Domain (>= 0.2.0)
- Scrutor (>= 5.0.1)
- System.Text.Json (>= 9.0.19)
-
net9.0
- FluentValidation (>= 11.11.0)
- FluentValidation.DependencyInjectionExtensions (>= 11.11.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Http.Resilience (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.ServiceDiscovery (>= 9.0.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.17.0)
- Polly.Core (>= 8.5.0)
- ResQ.BuildingBlocks.Application (>= 0.2.0)
- ResQ.BuildingBlocks.Domain (>= 0.2.0)
- Scrutor (>= 5.0.1)
- System.Text.Json (>= 9.0.19)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0 | 442 | 8/16/2026 |