# Case Study: How DropBot Tracks 80M+ Daily Price Calculations with Trifle ## Content # Case Study: How DropBot Tracks 80M+ Daily Price Calculations with Trifle *[DropBot](https://dropbot.sh) is a price comparison platform that calculates product prices across multiple markets. They use Trifle to gain full visibility into their pricing pipeline.* ## The Challenge At DropBot, one of the core domain focuses is product price calculation. They calculate around **80+ million products throughout the day**. Any time source data or other input for a product changes, the calculation is automatically updated. With that volume, things can go wrong silently. A data source might degrade. An SQS message might carry bad content. A calculation might produce unexpected results. Without visibility, these issues slip through unnoticed until a customer reports something off. DropBot needed a way to: - Track the volume and quality of incoming data triggers - Monitor calculation outcomes in real-time - Trace individual job executions step by step for debugging - Spot anomalies before customers do ## Tracking Source Events with Trifle::Stats DropBot has two main sources of data that trigger product calculations: periodic source data refreshes and SQS notifications. Using `Trifle::Stats`, they track both with fine 10m granularity. 10 minute resolution is just enough to catch recent spikes quickly. Daily charts reveal longer-term data quality degradation. For SQS processing (product updates backlog queue), the dashboard below shows how tracking its processing over time makes anomalies immediately visible and allows us to set up alerts for monitoring: ![Daily source data analytics](./case-study-dropbot/sqs.png) When you combine both triggers, you start getting a clear idea of what drives calculations and whether anything unusual is happening on either side. Then you can move to actual calculation stats. This is where `Trifle::Stats` helps the most. ![Hourly calculation breakdown](./case-study-dropbot/calculations.png) Seeing the breakdown for source data provides visibility into why certain calculations were triggered and whether the results are within expected ranges. ## Tracing Execution with Trifle::Traces Running a calculation job and storing just the result doesn't qualify as visibility. DropBot wanted to avoid scattering `puts` and `logger` statements everywhere and then trying to sort through a log aggregation service. They use `Trifle::Traces` to annotate their code with structured trace statements. At first it felt like a forced change, but as the team got used to it, they started structuring code to take full advantage: ```ruby def main_product @main_product ||= Trifle::Traces.trace('Fetching Main product') do Commodity::Product::Detail.find_by( store_id: main_store_id, store_uid: main_store_uid, zipcode: ) end end ``` This pattern produces shorter, single-purpose methods that use variable caching while still being fully traced during execution. The combination of `Trifle::Stats` and `Trifle::Traces` gives a high-level view of job execution alongside the ability to drill into any individual run: ![Execution list combining Stats and Traces](./case-study-dropbot/list.png) Clicking into a specific execution reveals the full trace, showing exactly what happened and how the final price was calculated: ![Detailed calculation trace](./case-study-dropbot/calculation.png) In the world of debugging, being able to follow execution step by step and see exactly how a number was produced is priceless. ## The Result With Trifle, DropBot has: - **Full pipeline visibility** across 80M+ daily calculations - **Early anomaly detection** that catches issues before customers notice - **Step-by-step execution traces** for every background job - **Self-hosted infrastructure** with no dependency on external log aggregation > "Being able to track source events and calculations gives us insight into how our system is operating. We can share details with our customers before they even notice that something seems off." --- Ready to get this kind of visibility into your own system? [Get started with Trifle](https://app.trifle.io) or [explore the documentation](https://docs.trifle.io).