28 releases

0.4.0-dev.0 Oct 9, 2024
0.3.0 Dec 17, 2024
0.3.0-rc.0 Oct 4, 2024
0.3.0-dev.3 May 29, 2024
0.2.0-beta-dev.7 Mar 27, 2024

#204 in Magic Beans

Download history 254/week @ 2024-08-26 316/week @ 2024-09-02 397/week @ 2024-09-09 448/week @ 2024-09-16 546/week @ 2024-09-23 480/week @ 2024-09-30 396/week @ 2024-10-07 584/week @ 2024-10-14 188/week @ 2024-10-21 166/week @ 2024-10-28 322/week @ 2024-11-04 110/week @ 2024-11-11 368/week @ 2024-11-18 238/week @ 2024-11-25 334/week @ 2024-12-02 140/week @ 2024-12-09

1,084 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