Skip to content

Refactor/observability#248

Merged
LeonardoVieira1630 merged 18 commits intodevfrom
refactor/observability
Apr 27, 2026
Merged

Refactor/observability#248
LeonardoVieira1630 merged 18 commits intodevfrom
refactor/observability

Conversation

@LeonardoVieira1630
Copy link
Copy Markdown
Member

@LeonardoVieira1630 LeonardoVieira1630 commented Apr 24, 2026

Summary

Introduces end-to-end observability across all four services (consumers, dispatcher, logic-system, subscription-server) by wiring in the shared @anticapture/observability package. Each app now bootstraps OpenTelemetry tracing, emits structured logs via an injected pino logger instead of console.*, and the subscription-server exposes a Prometheus /metrics endpoint for scraping. Existing behavior is unchanged — this is a cross-cutting instrumentation refactor.

Changes

  • Add @anticapture/observability + @opentelemetry/api dependencies to every app and pino-pretty at the root for local log formatting.
  • Add a side-effect instrumentation.ts bootstrap in each app that calls createObservabilityProvider(<service>); imported first in every index.ts so tracer patching happens before other modules load.
  • Wrap I/O-facing classes (clients, repositories, handlers, services) with wrapWithTracing(...) at composition roots in each app's index.ts.
  • Replace console.log / console.error usages with a structured createLogger(<service>) instance injected through constructors across clients, services, repositories, triggers, webhook server, and Fastify error handler.
  • Add a /metrics route on subscription-server that serves Prometheus output via the exporter exposed from instrumentation.ts.
  • Add try/catch around app startup in each index.ts to log failures through the structured logger before exiting.
  • Delete legacy per-app logger files in favor of the shared observability logger.
  • Make timestamps deterministic in non-voting-handler.test-factory.ts and update the related trigger-processor test accordingly.
  • Add pnpm.onlyBuiltDependencies: ["sqlite3"] to the root package.json.

@LeonardoVieira1630 LeonardoVieira1630 self-assigned this Apr 24, 2026
@LeonardoVieira1630 LeonardoVieira1630 added the enhancement New feature or request label Apr 24, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flow-editor Ready Ready Preview, Comment Apr 24, 2026 6:42pm
notification-system-dashboard Ready Ready Preview, Comment Apr 24, 2026 6:42pm

Request Review

@LeonardoVieira1630 LeonardoVieira1630 merged commit ce046ba into dev Apr 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants