frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Spendtrace, Feature-level AWS cost attribution (found a 17× gap))

https://github.com/Joshyi-Abini/Spendtrace
1•joshyi_ba•2h ago
Last year our Bedrock costs tripled in six weeks. AWS Cost Explorer told us "Amazon Bedrock: $4,200." That was the entire report. We had eight features using the model. We had no idea which one had changed. We spent two days correlating deployment timestamps with billing spikes before we found it. A caching bug in our recommendations feature was making three model calls where it should have made one. $2,800 of that bill was a single if-statement. I built spendtrace to make sure that never takes two days again. bash

```bash pip install spendtrace ```

python

```python import spendtrace spendtrace.auto_instrument() # patches boto3, openai, anthropic at startup

from spendtrace import cost_track

@cost_track(feature="ai_recommendations") def recommend(user_id): items = dynamo.get_item(...) # captured response = bedrock.invoke_model(...) # captured return response ```

That's the whole install. No proxy, no sidecar, no config file. One decorator per feature entry point and every boto3 and LLM SDK call inside it is attributed automatically. Then: python

```python for row in storage.aggregate_by_feature(): svc = row["service_costs"] print(f"{row['feature']:<25} bedrock=${svc.get('bedrock',0):.4f} dynamodb=${svc.get('dynamodb',0):.4f} total=${row['total_cost']:.4f}") ```

``` ai_recommendations bedrock=$0.7140 dynamodb=$0.0010 total=$0.7150 search bedrock=$0.0000 dynamodb=$0.0410 total=$0.0420 batch_processing bedrock=$0.0000 dynamodb=$0.0003 total=$0.0003 ```

The number that kept surprising people when I showed them this: `ai_recommendations` at $0.717 per call vs `search` at $0.042. Same product, 17x cost difference, nobody had ever seen that comparison before. A few things that took more thought than expected: The context propagation. When `search` calls `product_details` which calls DynamoDB, those reads should be attributed to `product_details` for debugging — but a product manager asking "what does search cost?" wants the fully-loaded number including everything it triggered. We store both. `parent_tx_id` on every transaction lets you reconstruct the full call tree:

``` api subtree=$0.018101 search subtree=$0.014000 product_details subtree=$0.003000 (×3) cache subtree=$0.000100 ```

The reconciliation problem. Your modelled costs (rate × count) will always drift from what AWS actually charges because the pricing API doesn't capture reserved capacity, data transfer, support plan, or volume discounts. We pull Cost Explorer by service (DynamoDB separately from S3 separately from Bedrock — not the blended total) and compute a per-service calibration factor. You can then restate historical records in one call if the model was off. The per-tenant angle. Add `user_id` to your request boundary and every nested call inherits it automatically through Python's `contextvars`. So you get cost per customer without instrumenting every function: python

```python @track_request(endpoint="/api/search", user_id=current_tenant_id) def handle(query): return search_products(query) # all nested costs go to this tenant ```

``` tenant-acme $47.21/month (8,341 requests) tenant-globex $12.88/month (3,102 requests) ```

This is exact attribution from the call stack, not inference from billing tags. What it doesn't do: It's not a proxy, not a dashboard (SQLite backend, self-hosted), not multi-cloud yet (AWS first, going deep before going wide). The `/metrics` endpoint exposes Prometheus counters if you want to alert on spend rate in Grafana. Code and README: https://github.com/Joshyi-Abini/Spendtrace Ask me anything about the context propagation design — it's the part I'm most proud of and most likely got wrong in ways I haven't found yet.

Comments

patty_pie•45m ago
The per-service calibration factor is the right call — blended totals are useless for attribution. Curious how stable your factors are over time though. In our experience, volume discounts and reserved capacity shift the multiplier enough month-to-month that historical restating becomes a moving target. Are you versioning the calibration factors, or just applying the latest one when you restate?
joshyi_ba•34m ago
Well, we compute per-service factors per reconciliation run, and each run's factors are saved with their date window (start_date, end_date, generated_at) in a report artifact. But restatement currently applies whatever factor you pass at execution time. There's no calibration_adjustments table tracking what corrections have already been applied to which date ranges. So double-application is a real risk if you're not disciplined about reusing the saved report. That's a gap we didn't notice, a correction history table is the right fix, thanks for that catch.
patty_pie•33m ago
Yeah, the double-application risk is subtle and very easy to miss until someone reruns a restatement and wonders why the numbers shifted. A correction history table with an applied_to_range column would cover it. Good tool, looking forward to seeing it develop further.

The AI Coding Velocity Trap

https://vnturing.github.io/blog/posts/the-velocity-trap/
1•elcapithanos•35s ago•0 comments

Show HN: A TUI for viewing Android adb logcat logs

https://github.com/parfenovvs/lazylogcat
1•parfenovvs•1m ago•0 comments

One CLI for all ofGoogle Workspace – built for humans and AI agents

https://github.com/googleworkspace/cli/
1•justinwp•1m ago•1 comments

Show HN: Chat, Generate, Refine and Export Your Hero Shot

https://bananai.net/
1•horushe•1m ago•0 comments

Before AI Agents Have Free Rein, We Need to Know Who They Work For

https://tether.name
1•Jawnnypoo•2m ago•1 comments

Show HN: Arxel – Constraint-driven 3D building masses in the browser

https://www.arxel.app/
1•OzanEnginsal•2m ago•0 comments

Slow Release of Federal Science Funds Holds Up Research

https://www.wnycstudios.org/podcasts/science-friday/articles/slow-release-of-federal-science-fund...
1•epistasis•2m ago•0 comments

Build vs buy: the script that outlived its assumptions

https://deborahjacob.substack.com/p/the-script-that-outlived-its-assumptions
1•deborahjacob•3m ago•0 comments

ANN: I built a new Ada build tool for personal use

https://github.com/tomekw/tada
2•PaulHoule•3m ago•1 comments

Show HN: Modeled healthcare de-identification as longitudinal RL control problem

https://github.com/azithteja91/amphi_rl_dpgraph
1•vkatganti•4m ago•0 comments

Future Shock

https://blog.ceejbot.com/posts/future-shock/
1•gzell•4m ago•1 comments

Show HN: SprintPulse – AI-powered retrospectives that drive action

1•SkyLinx•4m ago•0 comments

The Evolving Foundations of Math

https://www.quantamagazine.org/series/the-evolving-foundations-of-math/
1•7777777phil•5m ago•0 comments

1.5 Million Users Leave ChatGPT

https://www.forbes.com/sites/barrycollins/2026/03/02/leaving-chatgpt-make-sure-to-do-this-before-...
2•johnbarron•6m ago•0 comments

Todo for Developers

https://github.com/super-productivity/super-productivity
1•johannesjo•7m ago•0 comments

Users in 2 Weeks

https://www.founderspace.work
1•VladCovaci•8m ago•0 comments

The Thirty Million Line Problem (2019) [video]

https://www.youtube.com/watch?v=kZRE7HIO3vk
1•gebdev•8m ago•0 comments

CBP Tapped into the Online Advertising Ecosystem to Track Peoples' Movements

https://www.404media.co/cbp-tapped-into-the-online-advertising-ecosystem-to-track-peoples-movements/
3•ece•10m ago•0 comments

Gemini Said They Could Only Be Together If He Killed Himself. Soon, He Was Dead

https://www.wsj.com/tech/ai/gemini-ai-wrongful-death-lawsuit-cc46c5f7
2•psim1•11m ago•0 comments

Cursor is now available in JetBrains IDEs (ACP)

https://cursor.com/blog/jetbrains-acp
2•davidgomes•11m ago•0 comments

Show HN: Groundctl – "Terraform plan" for your local developer machine

https://github.com/Ravenium22/groundctl
1•ravenium22•11m ago•0 comments

Career Paths That Look Stable Until You See the Layoff Data

https://upperclasscareer.com/10-career-paths-that-look-stable-until-you-see-the-layoff-data/
1•randycupertino•12m ago•1 comments

With a 5x increase in Show HN, who sees what you build?

https://www.quantable.com/ai/attention-is-all-you-need/
2•jhpacker•12m ago•0 comments

Show HN: Rust rewrite of BitchX IRC client

https://github.com/heyAyushh/BitchX-rs
1•ay1221•12m ago•0 comments

Something is afoot in the land of Qwen

https://simonwillison.net/2026/Mar/4/qwen/
6•simonw•12m ago•0 comments

Context Rot Is Silently Killing Your Claude Code Sessions

https://vincentvandeth.nl/blog/context-rot-claude-code-automatic-rotation
1•amelius•12m ago•0 comments

Should I Block Ads?

https://shouldiblockads.com/
3•TigerUniversity•13m ago•0 comments

Arc Raiders – Discord SDK Data Exposure

https://timothymeadows.com/arc-raiders-discord-sdk-data-exposure/
2•lrae•14m ago•0 comments

MacBook Neo

https://www.apple.com/uk/macbook-neo/
1•_joel•14m ago•1 comments

I Learned to Stop Worrying, Love AI, and Be a Bit Less Responsible

https://www.georgesaines.com/blog/2026/3/3/how-i-learned-to-stop-worrying-love-ai-and-be-a-bit-le...
1•gsaines•14m ago•0 comments