Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 11 min read How-to mediumAdept

Monte Carlo Simulations: Separating Signal from Noise in Sampled Success Metrics

A Monte Carlo simulation can quantify how much sampling noise obscures real trends in a success metric that can only be measured by sampling, using Shopify App Store audits (a "shop issue rate" modeled as Poisson-distributed requirement violations) as the example. The method defines simulation metrics such as MAPE and the share of months where the sampled metric decreases (1mDO, 2mDO), generates sampled time series under assumed monthly improvement rates, repeats them across iterations, and grid-searches sample size and effect size in Python/pandas. With 10 mean issues, 100 audits per month and a true 5% monthly decrease, a decrease is observed in 83% of months and 97% over two months, giving stakeholders a concrete tradeoff between audit cost and certainty.

Assumes: basic probability distributionsPython and pandas

Related posts

  • Separating the signal from the noise

    Engineering@Microsoft easyNovice

    Noisy static analysis rules train developers to ignore all tool findings, including critical ones, so engineering system owners should prune false-positive-prone rules. Microsoft's 1ES team found a Pareto effect in bug telemetry: a small number of rules, such as CA2202 "Do not dispose objects multiple times," produced most "Won't Fix, False Positive" resolutions. Deprecating those rules caused an immediate and sustained drop in false positive reports as developers came to trust tool findings more. The key recommendation is to analyze noise per rule rather than per tool, since the same tool can have highly valuable rules, like Code Analysis cryptography checks that developers fix over 99% of the time.

  • 10 Lessons Learned From Online Experiments

    Shopify Engineering mediumAdept

    Ten practical lessons from a year of online A/B experiments on Shopify's multi-currency, geolocation and translation features. Randomization units should be independent (user rather than session, to avoid carryover), and simulations are a fast way to check statistical worries such as false-positive inflation when randomization and analysis units differ. A/A tests with redirects surfaced sample ratio mismatch caused by bots and client-side pageview logging, and in another experiment SRM traced to cookie-based qualification logic flipped the result from negative to positive. Other lessons: understand your data pipeline and log generously, peek at results (without stopping early) to catch outliers like a single high-volume store, and slice results by segment because the overall number is only an average.

  • How we build and evaluate our MCP server for SRE agents

    ClickHouse mediumAdept

    ClickHouse's open-source hdx-evals framework benchmarks MCP servers for SRE agents. It seeds deterministic synthetic telemetry (tens of millions of spans and logs with planted anomalies and distractors) into ClickHouse and runs sandboxed Claude Code agents against each MCP/model combination. Grading combines weighted regex checks with proximity-based negative checks for distractors (40%), a blinded LLM judge (60%), and a rate-based penalty for agent-caused tool errors. Five scenarios cover root cause, latency regression, Simpson's-paradox segmentation, noise reduction and no-incident health checks. Against a raw SQL ClickHouse MCP, the higher-level ClickStack MCP gave 18% more accurate outcomes, 26% fewer tool calls and 2.4x more consistent results.

  • Shifting Metrics Right

    Honeycomb mediumAdept

    Instead of pre-aggregating metrics inside applications, generate them as late as responsibly possible in the telemetry pipeline, either in the OpenTelemetry Collector or in the backend from traces and logs. The argument separates measurements (questions you want answered) from metrics (a pre-aggregated storage type). It claims the accuracy loss from sampling is negligible: one customer's sampled, trace-derived metrics were within 0.001% of their pre-aggregated data at a fraction of the cost. In-app aggregation buffers data for 10 to 60 seconds and can silently lose datapoints on a crash. A signaltometrics connector config shows how to derive HTTP semantic-convention exponential histograms from spans using AdjustedCount to account for sampling.

  • 5 Steps for Building Machine Learning Models for Business

    Shopify Engineering mediumAdept

    A five-step workflow for building ML models in a business context: confirm ML is warranted (defer it for brand-new products and beat a heuristic baseline first), start with simple models and basic features or off-the-shelf pretrained components, and pick a metric tied to business impact before optimizing. The advice also covers sanity-checking outputs via confusion matrices and residuals, since 98% accuracy on rare-event fraud data can mean a useless model. Model iteration should run through staging flows or A/B tests with fair comparisons and attention to run-to-run variance, and teams should watch prediction stability for individual users across retrains.

The quest for software engineering knowledge.

Look:
Layout: