Skip to content

feat(#261): implement cost allocation metrics by provider and feature - #321

Open
Ebuka042-pixel wants to merge 1 commit into
Pidoko257:mainfrom
Ebuka042-pixel:feat/issue-261-cost-allocation-metrics
Open

feat(#261): implement cost allocation metrics by provider and feature#321
Ebuka042-pixel wants to merge 1 commit into
Pidoko257:mainfrom
Ebuka042-pixel:feat/issue-261-cost-allocation-metrics

Conversation

@Ebuka042-pixel

Copy link
Copy Markdown
  • Add costAllocationMetrics service with Prometheus counters/histograms/gauges labeled by provider (mtn, airtel, orange, stellar) and feature (deposit, withdraw, kyc, webhook, aml, reconciliation, etc.)
  • Track API calls, DB queries, and storage bytes per provider+feature
  • Calculate unit cost per transaction (USD-cents) using configurable rates via COST_PER_API_CALL_USD_CENTS / COST_PER_DB_QUERY_USD_CENTS env vars
  • Expose cost_estimated_cents_per_transaction Prometheus gauge for Grafana
  • Add GET /api/admin/cost-allocation (JSON analytics) endpoint
  • Add GET /api/admin/cost-allocation/export (CSV export for data warehouse)
  • Wire route into index.ts under requireAuth guard
  • Add unit tests covering api, db, storage accumulation and cost sorting
  • Update .gitignore to exclude snapshots, scratch, .pull_request, pacts

Description

Brief description of changes.

Related Issue

Fixes #(issue number)

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring
  • Performance improvement

Changes Made

Testing

How did you test these changes?

Checklist

  • Code follows project style
  • Self-reviewed my code
  • Commented complex code
  • Updated documentation
  • No new warnings
  • Added tests (if applicable)

Screenshots (if applicable)

Additional Notes

closes #261

…d feature

- Add costAllocationMetrics service with Prometheus counters/histograms/gauges
  labeled by provider (mtn, airtel, orange, stellar) and feature (deposit,
  withdraw, kyc, webhook, aml, reconciliation, etc.)
- Track API calls, DB queries, and storage bytes per provider+feature
- Calculate unit cost per transaction (USD-cents) using configurable rates
  via COST_PER_API_CALL_USD_CENTS / COST_PER_DB_QUERY_USD_CENTS env vars
- Expose cost_estimated_cents_per_transaction Prometheus gauge for Grafana
- Add GET /api/admin/cost-allocation (JSON analytics) endpoint
- Add GET /api/admin/cost-allocation/export (CSV export for data warehouse)
- Wire route into index.ts under requireAuth guard
- Add unit tests covering api, db, storage accumulation and cost sorting
- Update .gitignore to exclude snapshots, scratch, .pull_request, pacts
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Ebuka042-pixel 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

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.

Implement Cost Allocation Metrics by Provider and Feature

1 participant