Files
goodgo-platform/apps/api/src/modules/metrics/metrics.constants.ts
Ho Ngoc Hai cc736e9137 fix(tests): create missing infrastructure stubs and fix AVM spec (GOO-131)
Several committed modules imported files that were never created, causing
every spec that imports SharedModule/NotificationsModule to fail with
"Cannot find module" errors. This commit provides the missing pieces:

API infrastructure stubs (RFC-001/GOO-170 in-flight feature deps):
- shared/infrastructure/versioning.ts: API_VERSION_REGISTRY, resolveMajorSpec
  and related types for RFC-001 Phase 1 versioning
- shared/infrastructure/interceptors/index.ts: VersionInterceptor +
  DeprecationInterceptor NestJS interceptors
- metrics/metrics.constants.ts: add READ_MODEL_PROJECTOR_LAG_SECONDS,
  READ_MODEL_REFRESH_DURATION_SECONDS, READ_MODEL_RECONCILIATION_DRIFT_TOTAL

Phone-login OTP flow (GOO-182 in-flight deps):
- auth/domain/events/phone-login-otp-requested.event.ts: DomainEvent stub
- notifications/.../phone-login-otp-requested.listener.ts: event listener

AVM spec fix:
- analytics/.../prisma-avm.service.spec.ts: switch mock from $queryRawUnsafe
  to $queryRaw (findComparables was parameterized in 6774914) and use
  mockResolvedValueOnce for correct call-order semantics

After these changes all 333 API + 148 web tests pass.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-24 14:47:07 +07:00

30 lines
1.6 KiB
TypeScript

// ── Business Metrics (goodgo_ prefix) ──
export const GOODGO_LISTINGS_CREATED_TOTAL = 'goodgo_listings_created_total';
export const GOODGO_PAYMENTS_PROCESSED_TOTAL = 'goodgo_payments_processed_total';
export const GOODGO_ACTIVE_SUBSCRIPTIONS = 'goodgo_active_subscriptions';
export const GOODGO_SEARCH_QUERIES_TOTAL = 'goodgo_search_queries_total';
export const GOODGO_API_REQUEST_DURATION = 'goodgo_api_request_duration_seconds';
// ── Infrastructure Metrics ──
export const HTTP_REQUESTS_TOTAL = 'http_requests_total';
export const DB_QUERY_DURATION = 'db_query_duration_seconds';
export const DB_POOL_ACTIVE_CONNECTIONS = 'db_pool_active_connections';
export const SEARCH_QUERY_DURATION = 'search_query_duration_seconds';
// ── WebSocket Metrics ──
export const GOODGO_WS_CONNECTED_CLIENTS = 'goodgo_ws_connected_clients';
export const GOODGO_WS_MESSAGES_TOTAL = 'goodgo_ws_messages_total';
// ── Read-Model / Projection Metrics ──
export const READ_MODEL_PROJECTOR_LAG_SECONDS = 'goodgo_read_model_projector_lag_seconds';
export const READ_MODEL_REFRESH_DURATION_SECONDS = 'goodgo_read_model_refresh_duration_seconds';
export const READ_MODEL_RECONCILIATION_DRIFT_TOTAL = 'goodgo_read_model_reconciliation_drift_total';
// ── Web Vitals / RUM Metrics ──
export const WEB_VITALS_LCP = 'goodgo_web_vitals_lcp_seconds';
export const WEB_VITALS_FCP = 'goodgo_web_vitals_fcp_seconds';
export const WEB_VITALS_CLS = 'goodgo_web_vitals_cls';
export const WEB_VITALS_TTFB = 'goodgo_web_vitals_ttfb_seconds';
export const WEB_VITALS_INP = 'goodgo_web_vitals_inp_seconds';
export const WEB_VITALS_TOTAL = 'goodgo_web_vitals_total';