Skip to content

Add TailoredApps.Shared.WebApi production defaults package#44

Merged
nieprzecietny merged 2 commits into
masterfrom
feature/webapi-production-defaults
Jul 8, 2026
Merged

Add TailoredApps.Shared.WebApi production defaults package#44
nieprzecietny merged 2 commits into
masterfrom
feature/webapi-production-defaults

Conversation

@nieprzecietny

Copy link
Copy Markdown
Member

Summary

New shared package TailoredApps.Shared.WebApi that wires production-ready defaults into an ASP.NET Core Web API through a single call, together with its hand-maintained NuGet publish step in release.yml.

builder.AddTailoredWebApiDefaults();
// ...
app.MapTailoredWebApiDefaults();

What it configures

  • Metrics / Tracing / Logging — OpenTelemetry for ASP.NET Core, HttpClient and the .NET runtime, exported over OTLP
  • Health checks — readiness /health (all checks) and liveness /alive (live-tagged), with a safe JSON writer
  • HTTP clients — standard resilience handler (retry, circuit breaker, timeouts) + service discovery on every factory client

All features bind from the WebApiDefaults configuration section and are individually toggleable. OTLP is the default exporter (stable); a metrics hook is provided for opting into a Prometheus scrape endpoint (whose ASP.NET Core exporter is still beta-only).

Packaging / CI

  • Multi-targets net8.0 / net9.0 / net10.0; resilience & service-discovery packages pinned per TFM (8.x / 9.x / 10.x), OpenTelemetry at 1.x
  • release.yml: dedicated, hand-maintained dotnet nuget push step for the new package (no migration to a glob push)
  • Registered in the solution; the new tests run automatically in PR CI

Tests

10 xUnit tests (registrations, config binding + precedence, disable toggles, endpoint mapping, null guards). Full solution builds with 0 errors; all tests pass locally.

Publish preconditions (outside this PR)

  • Tag a commit that includes this PR with v* to trigger release.yml
  • Ensure NUGET_API_KEY may push the new id TailoredApps.Shared.WebApi — the first push of a new id needs a glob/new-package-scoped key, and the push step is continue-on-error, so a 403 would be silent

🤖 Generated with Claude Code

nieprzecietny and others added 2 commits July 8, 2026 11:36
Introduces a shared package that wires production-ready defaults into an
ASP.NET Core Web API through a single AddTailoredWebApiDefaults /
MapTailoredWebApiDefaults pair:

- OpenTelemetry metrics, tracing and logging exported over OTLP
- Liveness (/alive) and readiness (/health) health checks
- Standard resilience handler and service discovery for HTTP clients

All features bind from the WebApiDefaults configuration section and are
individually toggleable. OTLP is the default exporter (stable); a metrics
hook is provided for opting into a Prometheus scrape endpoint.

Also:
- tests/TailoredApps.Shared.WebApi.Tests: 10 xUnit tests
- Register both projects in the solution (test under the Tests folder)
- release.yml: add a hand-maintained NuGet push step for the new package
- docs/WebApi.md: usage page

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…uction-defaults

# Conflicts:
#	.github/workflows/release.yml
#	TailoredApps.Shared.sln
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.64103% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.43%. Comparing base (29a65a1) to head (d7e79c8).

Files with missing lines Patch % Lines
...d.WebApi/HealthChecks/HealthCheckResponseWriter.cs 12.50% 21 Missing ⚠️
....WebApi/Observability/OpenTelemetryRegistration.cs 85.18% 2 Missing and 6 partials ⚠️
...ed.WebApi/HealthChecks/HealthCheckRequestFilter.cs 0.00% 5 Missing ⚠️
...bApi/HealthChecks/HealthCheckEndpointExtensions.cs 78.57% 2 Missing and 1 partial ⚠️
...oredApps.Shared.WebApi/WebApiDefaultsExtensions.cs 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   54.62%   57.43%   +2.80%     
==========================================
  Files         101      112      +11     
  Lines        3405     3033     -372     
  Branches      294      324      +30     
==========================================
- Hits         1860     1742     -118     
+ Misses       1464     1202     -262     
- Partials       81       89       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nieprzecietny nieprzecietny left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@nieprzecietny
nieprzecietny merged commit 86e2995 into master Jul 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant