Skip to content

feat: request tracing and structured logs, enforced API versions, RFC ETag matching - #1820

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
Pro-builder:feat/api-caching-versioning-observability
Oct 17, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
Pro-builder:feat/api-caching-versioning-observability

Conversation

@Pro-builder

Copy link
Copy Markdown
Contributor

Closes #1788
Closes #1789
Closes #1790
Closes #1791

#1788 ETag and conditional requests

  • isETagMatch (compression.ts, used by server.ts via sendJson) now does the RFC 9110 weak comparison: comma-separated lists and W/ tags match, so CDNs that weaken the tag still get a 304.
  • Integration test in server.test.ts: ETag emitted, 304 for exact, list and weak matches, 200 for a stale tag. Unit tests in compression.test.ts.
  • docs/etag-caching.md now describes the real code path.

#1789 API versioning

  • versionRegistry reflects what is served: v1 active and default.
  • resolveVersion rejects an explicitly requested unknown version (path, header or query) with 400 VERSION_NOT_FOUND instead of serving the default. Fixes the 4 failing tests in apiVersioning.test.ts.
  • createVersionMiddleware mounted in server.ts and createApiServer.ts; responses carry api-version.
  • docs/api-versioning.md: current state, strategy and deprecation policy (6 month minimum window, headers, 410 on sunset).

#1790 Structured request logging

  • New backend/shared/middleware/requestObservability.ts, mounted in both servers.
  • X-Request-Id kept from the caller when safe, otherwise a UUID; echoed and used as the log correlationId for everything logged during the request.
  • One http.request log per request with requestId, traceId, spanId, method, path, status, durationMs.
  • No PII: no query strings, headers, bodies or IPs; email and long number path segments masked. Tested.
  • docs/api-logging.md documents the format.

#1791 Distributed tracing

  • The same middleware creates a server span that continues the incoming traceparent and exports through createTracerFromEnv (OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is set).
  • Logs carry traceId/spanId and spans carry request.id.
  • server.ts accepts an injected tracer for tests.
  • docs/distributed-tracing.md updated with the real backend setup and log correlation.

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Pro-builder Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit 9cb43d2 into Smartdevs17:main Oct 17, 2026
2 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.

Add distributed tracing Add structured request logging Add API versioning strategy Add ETag and conditional requests

1 participant