Skip to content

Observability defect patterns

This page lists defects in ConnectSoft logging, telemetry and health checks. An observability defect does not break a feature by itself. It hides a broken one, misreports a working one, or makes the service slow or unsafe while it watches. Each pattern names the symptom, the cause, what to look for in a review, and how to prove the code is sound. The rules these patterns break are on the logging, metrics, error handling and configuration and options pages.

Failures that leave no trace

CS-DP-LOG-001: Catch block hides a refused or failed operation

Severity: major · Applies to: service, library, api-client, blazor, template · Enforced by: manual · Status: active

Symptom

A failed upload, a refused save or a broken export shows nothing, an empty dashboard or a raw fallback file, and the happy-path tests stay green.

Cause

An empty or broad catch block, for example for HttpRequestException, ArgumentException or a validation exception, sets an empty result or returns the undecorated input without logging or showing the reason. Sometimes the failure is reported on a form that has already closed.

Check

catch blocks in UI handlers and gateway use cases that neither log nor surface the failure.

Test

Make the downstream call fail, and assert a visible error and a log entry.

CS-ERR-001, CS-UI-017

CS-DP-LOG-002: Enrichment maps an unknown reference to blank without a signal

Severity: major · Applies to: service, library, template · Enforced by: manual · Status: active

Symptom

Many report rows have empty names and still count in totals, and drift from the system of record looks like a rendering bug.

Cause

The enricher maps ids it cannot resolve to an empty string on purpose, but writes no log entry, metric or marker.

Check

Lookup or enrichment code that returns a silent default when a reference is not found.

Test

Enrich a set that contains one unknown id, and assert a warning or a counter that gives the number of misses.

CS-LOG-008, CS-ERR-001

CS-DP-LOG-003: Infrastructure failure mapped to a 4xx status is never logged

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

A CI failure carries only an error id, and the database error appears in no log or artifact.

Cause

The shared problem details setup decides whether to log by status and logs only 5xx, so an infrastructure exception mapped to a 4xx status, such as 424, is silent. Acceptance hosts run in the Production environment, so detail shown only in Development never appears.

Check

  • Status-based rules for logging unhandled exceptions.
  • Infrastructure exceptions mapped to a 4xx status.
  • Mapping functions that call GetRequiredService, since a mapping that throws falls through to 500.

Test

A test host that raises a database exception asserts the mapped status and that an Error log entry was written.

CS-API-010, CS-ERR-003, CS-ERR-004

CS-DP-LOG-004: Request log reports 500 for a refusal the client received as 4xx

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

The logs show many "responded 500" lines, while the clients received 403 or 404.

Cause

The request-logging middleware is registered inside the problem details middleware, so it records the exception on its way out, before the exception is mapped to its final status.

Check

  • UseSerilogRequestLogging, or similar request logging, registered after the exception mapping middleware.
  • Dashboards or triage that count those lines as server errors.

Test

A test host that asserts the status the caller receives, and that a mapped refusal is not logged as 500.

CS-LOG-009, CS-ERR-002, CS-ERR-005

Logging content and cost

CS-DP-LOG-005: Diagnostics log claim values and one-time codes

Severity: blocker · Applies to: service, library, template · Enforced by: manual · Status: active

Symptom

Logs or trace tags contain every claim value of a user, device codes or user codes.

Cause

Debug-style logging was left in the token flows, and a trace enricher records all claim values.

Check

Log statements and activity tags in authentication code that write claim values, codes or tokens.

Test

A log-capture test over the token flow that asserts no claim value or code appears in any log entry or tag.

CS-LOG-005, CS-LOG-007

CS-DP-LOG-006: Debug logging in test settings floods the test runner

Severity: major · Applies to: service, template, pipelines · Enforced by: manual · Status: active

Symptom

A CI test run takes tens of minutes and dies with OutOfMemoryException in the results logger, and database memory waits appear in the same run.

Cause

Test settings set the default and ORM log categories to Debug with a console sink, and the test runner keeps all captured output in memory.

Check

Debug or Trace levels, or console sinks, in committed test or CI settings.

Test

A pipeline check that fails when test settings set the default or ORM level below Information.

CS-CFG-012, CS-CFG-004

CS-DP-LOG-007: Synchronous telemetry sink on the request path

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

Trivial request steps take seconds while the database is idle and the thread-pool queue is empty, and raising concurrency makes it worse.

Cause

A console trace exporter, a console log sink or Debug-level logging exports synchronously under a process-wide lock. Exporter endpoints that point at hosts that do not exist add blocking retries.

Check

Console exporters or sinks that are on, Debug minimum levels, and exporter endpoints that point at hosts that do not exist.

Test

A load smoke test that measures the latency of concurrent requests with the shipped settings.

CS-CFG-004

CS-DP-LOG-008: Log enricher writes response headers after the response started

Severity: major · Applies to: service, library, template · Enforced by: manual · Status: active

Symptom

Logging self-diagnostics report "Headers are read-only", and the log events of one request carry different correlation ids.

Cause

A correlation-id enricher adds the response header on every log event without checking Response.HasStarted, and creates a new id when the header is absent.

Check

  • Enrichers or middleware that write response headers from logging paths.
  • An old and a replacement enricher assembly both listed in Serilog:Using.
  • Enricher assemblies left behind in output folders.

Test

An enricher test with a response that has started, which asserts that no exception is thrown and that the request keeps one id.

CS-LOG-010

Health checks

CS-DP-LOG-009: Hosted background work fails behind a green health endpoint

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

/health returns Healthy while a background collector throws on every poll, or while the database has no tables.

Cause

The health checks prove only that the process runs and that the database accepts connections. They do not cover the progress of hosted services or the presence of the schema.

Check

Health-check registrations of a service that runs hosted services or depends on a schema, with no check that covers them.

Test

A health test that drops a table, or makes a hosted service fail, and asserts that the health status degrades.

CS-MET-008

CS-DP-LOG-010: Health dashboard collector cannot build a URI from a wildcard binding

Severity: minor · Applies to: service, template · Enforced by: manual · Status: active

Symptom

The health dashboard collector logs that it could not get the endpoint URI on every poll, while direct /health calls succeed.

Cause

A relative health endpoint is prefixed with the first server address, and a web server binding without a host name reports https://*:port/, which is not a valid URI.

Check

Health dashboard endpoints configured with a relative URI in a service deployed behind bindings without a host name.

Test

A collector test with a fake server-addresses feature that carries a wildcard address, which asserts that the configured absolute URI is polled successfully.

CS-MET-009, CS-CFG-005