14 releases

new 0.3.0-dev.2 May 15, 2024
0.3.0-dev.1 May 1, 2024
0.2.1-rc.0 May 16, 2024
0.2.0-beta-dev.9 Apr 24, 2024
0.2.0-beta-dev.2 Jan 12, 2024

#2935 in Magic Beans

Download history 67/week @ 2024-01-28 132/week @ 2024-02-04 3/week @ 2024-02-11 133/week @ 2024-02-18 146/week @ 2024-02-25 462/week @ 2024-03-03 367/week @ 2024-03-10 488/week @ 2024-03-17 204/week @ 2024-03-24 180/week @ 2024-03-31 364/week @ 2024-04-07 465/week @ 2024-04-14 535/week @ 2024-04-21 728/week @ 2024-04-28 386/week @ 2024-05-05 535/week @ 2024-05-12

2,193 downloads per month
Used in 3 crates (via hc_sleuth)


2.5K SLoC


Experimental library for modeling causality chains, and inferring diagnostic info from observed events

Needs more documentation.

License: Apache-2.0


aitia, a crate for gaining insights from causal graphs

("aitia" is the root of "etiology", the study of causes, and also an easy-to-type palindrome)

In complex systems, when something is going wrong, it can be difficult to narrow down the dep to some subsystem without doing lots of forensic poking around and exploratory logging. aitia aims to help with this process of narrowing down the possible scope of a problem.

You define a collection of Facts about your system, each of which specifies one or more [Dep]s (dependencies). The causal relationships between Depsimply a graph, with each Fact connected to others. When testing your system, you can check whether a particular Fact is true or not. If it's not true, aitia recursively follows the causal relationships specified, building up a graph of deps, each of which is checked for truth. The traversal stops only when either:

  1. a true fact is encountered, or
  2. a fact without any deps of its own is encountered (an "axiom" so to speak)
  3. a loop of unresolved deps is discovered, in which case that entire branch is discarded. Note that loops in causal relationships are allowed, as long as there is a Fact along the loop which passes, causing the loop to be broken

The result is a directed acyclic graph (DAG) of all facts that are not true, with the original fact as the root. The edges of the graph represent logical conditionals or implications: i.e. an edge A -> B in the graph means "If A is true, then B must be true", and also "if B is not true, then A cannot be true". This means that the leaves of the DAG represent the possible root deps of the problem, i.e. the "most upstream" known facts which could dep the root fact to not be true, and so the leaves would represent the places in the system to look for the reason why your original fact was not true.

aitia is as useful as the Facts you write. You can write very broad, vague facts, which can help you hone in on broader parts of the system for further manual investigation, or you can write very specific facts which can tell you at a glance what may be the problem. It lends itself well to writing facts iteratively, broadly at first, and then adding more specificity as you do the work of diagnosing the problems that it helped you find.

aitia is meant to be an embodiment of the process of deducing the dep of a problem. By encoding your search for a problem into an aitia::Dep, ideally you will never have to hunt for that particular problem again.


~301K SLoC