On this page
Explain backend request time
Compose structured logs, telemetry and controlled server timing.
Goal: correlate structured logs and traces, and expose the server's contribution to a future page-performance panel without disclosing SQL or sensitive input.
Configure the host
AddFabricatorsObservability configures compact Serilog JSON, trace correlation and OpenTelemetry resources. Supply ServiceName and ServiceVersion. OTLP exporters are enabled only when OtlpEndpoint is explicitly configured. A logging worker can use this package without ASP.NET or EF adapters.
AddFabricatorsHttpDiagnostics and UseFabricatorsRequestDiagnostics add request measurements. The optional EF interceptor measures command duration without collecting SQL text or parameters. Add domain spans for meaningful product work; do not put document bodies, credentials or customer identifiers into span names.
Response timing contract
Server-Timing describes backend work up to response start. It is not total response streaming time, browser rendering time or page load time. Child cache/DB measurements may overlap and must not be added blindly to request duration.
The frontend can correlate an authorized trace with its own request, hydration and render measurements. It owns the final page-load visualization. Cross-origin Timing-Allow-Origin and propagation through a BFF require explicit product policy.
Disclosure is intentional
Starting in 0.14.0, timing and trace disclosure defaults to disabled,
including in Development. Use the public authorization gate
to require both explicit environment enablement and current diagnostic permission.
The low-level API retains an explicit Development bypass or a product-owned
DisclosurePolicy for compatibility. Published 0.13.0 enabled Development by
default; that default is changed by this source increment. A caller header or
role alone must never grant diagnostics. Preserve Cache-Control: no-store at
the BFF/proxy and keep internal telemetry independent of response disclosure.
Starting in 0.16.0, the public gate evaluates its registered policy quietly:
an ordinary denied disclosure emits no authorization-failure log and
does not deny the request. Real endpoint authorization still uses ASP.NET
policies and retains denial logging. Additional policy requirements and live
permission adapters remain enforced. The low-level middleware also
accepts DisclosurePredicate; when present, false never falls back to the
Development opt-in or the legacy policy.
The middleware omits timing, trace and JSON headers when the response declares caching/revalidation or carries validators/cache metadata. It preserves those headers, including public CDN caching, rather than replacing them with no-store. An existing no-store policy is preserved; a permitted diagnostic response with no cache policy gets no-store. Place diagnostics outside response-cache writers so its OnStarting callback sees their final policy. BFFs must preserve this boundary rather than copying private timing into a public cached response.
EF command errors and hosting errors, including startup exceptions, are retained
starting in 0.16.0. Successful SQL and raw ASP.NET request start/end events
remain suppressed by default; Foundation supplies sanitized completion events.
ObservabilityOptions.IncludeFrameworkRequestLogs explicitly enables raw events
when a host needs them; they can contain full URLs and duplicate completion logs.
Failed SQL retains EF's default parameter redaction. Raw SQL literals and
EnableSensitiveDataLogging can still expose data; this is not a SQL sanitizer.
Verify your deployment
Check structured logs locally, then confirm resource identity and trace propagation at the real collector. Foundation's loopback acceptance suite does not prove a customer's collector, network policy or retention settings.
Next: observability API and HTTP diagnostics API.