What's in the black box? Finding out on our own without attracting colleagues' attention

Mikhail (m03r on Habr)2 Jul 2025

Problem

Yandex Eda wanted to move order processing out of a PHP monolith into a separate service. To decide what to move, the team needed a full and current list of processes that happen to an order. That knowledge was spread over many people and documents. Reading the code was unrealistic: 1.5 million lines of PHP, 30 thousand classes, and of 1,500 endpoints and workers every fifth is related to orders. Asking a dozen adjacent teams was slow and error-prone.

Example from the article: the team needed to know which services push the "delivered" status, through which endpoint or queue, for which order types.

Solution in brief

Treat the monolith as a black box and record only what crosses its boundary: DB reads and writes, incoming and outgoing HTTP, and queue operations, each tagged with the order number. Load the log into DuckDB, filter it, and run process mining in R to draw maps of what happens, then show the maps to the owners of adjacent services.

Questions this case answers
  • How to reconstruct the real processes of a large legacy system from its externally visible events when code and people cannot be read or asked in time
  • How to turn a huge noisy event log into process maps a person can read
  • How to find out which processes an order goes through inside a large legacy monolith when no one has the full picture?
  • How to build a process map from application events when tracing is incomplete?

Tools and methods

  • Process mining — process maps and causal nets from an event log
  • Event listener tracer — 255 lines of PHP on Symfony events
  • DuckDB — local analysis of a 17 GB compressed log from R through dbplyr
  • bupaR, processmapR, heuristicsmineR — event log structure, process maps, causal nets for parallel processes
  • Stratified sampling — 5000 random orders per combination of order parameters
Continue reading — it's free

Google or a one-time email code. No password.