Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Phase 1] Observability Baseline (Structured Logging & Metrics)</issue_title>
<issue_description>## Priority: P0 (Critical)
Phase: 1 - E-Commerce Core
Estimate: 2 days
Type: Story

Context

Establish minimal observability: structured JSON logging, domain event logs, metrics counters/gauges for critical subsystems (payments, inventory, idempotency, webhooks).

Scope

  • Logging utility wrapper (pino or console structured) log.info({evt, ...context})
  • Correlation ID middleware (request-scoped, include in logs)
  • Metrics facade (in-memory dev; future Prometheus) with simple increment/observe APIs
  • Emit metrics: payment.attempt.count, idempotency.replay.count, inventory.reservation.active, webhook.delivery.success/failure
  • Error logging with stack, route, orgId, userId (if available)

Acceptance Criteria

  • All domain actions log structured event (key: evt)
  • Correlation ID present across chained logs within request scope
  • Metrics counters increment visible via temporary /api/debug/metrics endpoint (dev only)
  • Sensitive data (secrets, tokens) excluded from logs
  • Performance overhead < 3% of request time (qualitative dev measurement)

Example Log Shape

{
  "level": "info",
  "evt": "inventory_reservation_created",
  "reservationId": "res_123",
  "productId": "prod_42",
  "orgId": "org_9",
  "correlationId": "req_abcd",
  "durationMs": 12
}

Dependencies

Metrics Targets

  • Coverage: >= 90% of P0 domain actions logged
  • Zero PII leakage (manual inspection)

Testing Checklist

  • Log emitted for reservation create
  • Correlation ID consistent across payment attempt sequence
  • Metrics endpoint returns increments

Risk

Without baseline, debugging & reliability degrade (score: 15). Foundational for scale.

References

  • docs/GITHUB_ISSUES_COMPARISON_ANALYSIS.md (observability gap)
    </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Nov 25, 2025

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

Project Deployment Preview Comments Updated (UTC)
stormcomui Ready Ready Preview Comment Nov 25, 2025 2:43am

Copy link
Contributor

@AshrafAbir AshrafAbir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impliment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Phase 1] Observability Baseline (Structured Logging & Metrics)

3 participants