Skip to content

notification-service: Metrics module is defined and tested in isolation but never instantiated in the running service #336

Description

@abayomicornelius

Area

Notification Service / Observability

Complexity

Easy

File(s)

notification-service/src/index.ts (main, lines 38-93); notification-service/src/metrics.ts; notification-service/src/api.ts (createApi, lines 88-92)

Problem

Metrics.recordEventProcessed()/recordNotificationSent() are only ever called from metrics.test.ts and api.test.ts. In index.ts's real main(), no Metrics instance is created, createApi(store) is called with no options.metrics, and neither handleScoreChanged nor Notifier.notifyInvestors records anything. Result: in production, GET /metrics 404s, and even if wired, the counters would never move — there is zero runtime observability into event/notification volume.

Scope

In:

  • Instantiate Metrics in main(), pass it to createApi, call recordEventProcessed in the listener callback and recordNotificationSent on each successful delivery in notifyInvestors.

Out:

  • A full metrics backend (Prometheus/StatsD export) — the in-memory snapshot model can stay.

Acceptance Criteria

  • GET /metrics returns non-zero eventsProcessed/notificationsSent after real events flow through main()'s wiring
  • At minimum the happy-path counters are actually live in production, not just in tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions