How anuppillai1784/tenant-cost-attribution works
This Python tool attributes inference-request spend to tenants, departments, and features, then checks reconciliation, projects budgets, and detects daily spend spikes. The main workflow is the demo command: generate events, ingest and reload them from SQLite, price and aggregate them, then write JSON outputs and print a text summary. The separate reconcile command checks stored events. The graph preserves the documented pricing, reporting, budget, anomaly, and synthetic-demo capabilities. Relationships are supported by the README and indexed excerpts; unsampled implementation details are not inferred.
Main entry points: demo.py Demo runner · cli.py CLI commands · render.py Text rendering · report.py Report data
Components 15
Command entry
- Module entry
cost_attribution/__main__.py - CLI commands
cost_attribution/cli.py - Demo runner
cost_attribution/demo.py
Event ingestion
- Synthetic events
cost_attribution/synthetic.py - Event ledger
cost_attribution/ledger.py
Spend accounting
- Versioned pricing
cost_attribution/prices.py - Attribution and reconciliation
cost_attribution/attribution.py
Analysis and output
- Budget projection
cost_attribution/budgets.py - Report data
cost_attribution/report.py - Anomaly detection
cost_attribution/anomalies.py - Text rendering
cost_attribution/render.py - Report JSON
examples/report.json - Alerts JSON
examples/alerts.json
Other components
- Operator
- Terminal output
Connections 21
- Operator → Module entry: runs module
README.md - Module entry → CLI commands: calls main
cost_attribution/__main__.py - CLI commands → Demo runner: runs demo
cost_attribution/cli.py - CLI commands → Event ledger: opens and loads
cost_attribution/cli.py - CLI commands → Attribution and reconciliation: prices and reconciles
cost_attribution/cli.py - CLI commands → Text rendering: renders result
cost_attribution/cli.py - CLI commands → Terminal output: prints summary
cost_attribution/cli.py - Demo runner → Synthetic events: generates events
cost_attribution/demo.py - Demo runner → Event ledger: ingests and loads
cost_attribution/demo.py - Demo runner → Attribution and reconciliation: prices and aggregates
cost_attribution/demo.py - Attribution and reconciliation → Versioned pricing: prices events
cost_attribution/attribution.py - Demo runner → Anomaly detection: detects anomalies
cost_attribution/demo.py - Demo runner → Report data: builds report
cost_attribution/demo.py - Report data → Attribution and reconciliation: totals by dimension
cost_attribution/report.py - Report data → Budget projection: projects budgets
cost_attribution/report.py - Demo runner → Report JSON: writes report
cost_attribution/demo.py - Demo runner → Alerts JSON: writes alerts
cost_attribution/demo.py - Demo runner → Text rendering: renders summary
cost_attribution/demo.py - Text rendering → Report data: formats report
cost_attribution/render.py - Text rendering → Anomaly detection: formats alerts
cost_attribution/render.py - Text rendering → Terminal output: prints summary