26 releases

0.4.0-dev.0 Oct 9, 2024
0.3.0-dev.6 Sep 25, 2024
0.3.0-dev.3 May 29, 2024
0.2.0-beta-dev.7 Mar 27, 2024

#283 in Magic Beans

Download history 759/week @ 2024-07-30 338/week @ 2024-08-06 308/week @ 2024-08-13 336/week @ 2024-08-20 272/week @ 2024-08-27 326/week @ 2024-09-03 445/week @ 2024-09-10 394/week @ 2024-09-17 517/week @ 2024-09-24 525/week @ 2024-10-01 370/week @ 2024-10-08 565/week @ 2024-10-15 229/week @ 2024-10-22 203/week @ 2024-10-29 223/week @ 2024-11-05 211/week @ 2024-11-12

896 downloads per month
Used in 11 crates (4 directly)

Apache-2.0

51KB
1K SLoC

aitia

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

Needs more documentation.

License: Apache-2.0


lib.rs:

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.

Dependencies

~5–12MB
~129K SLoC