Comment by adolgert

13 years ago

It makes me so happy to see such a clear picture of how service logs relate to the input and output token streams of finite state machines. We usually think of finite state machines as these little objects with a few states, but the category theory version of them is an essential definition of what it means for a system to be deterministic and depend only on current state and given inputs. It's a set of allowable input tokens (the input log), a set of allowable output tokens (the output log of actions taken by the system), an internal state Q, a dynamics delta that decides the next state from the previous one, and an output function lambda that decides what output token to return given the current input state.

By making the statement that logs are streams of tokens which have deterministic effect, this author is assuming that the services are finite state machines. This may not be the case if, for instance, they do not set random number generators to a known state. Any way a service doesn't just depend on its previous state violates this principle. If it meets this principle, then the logs are, by definition, taken from the strings of allowable input tokens X or the strings of allowable output tokens Y.

The debate in the article about at what level to log is a debate about which portion of the service to treat as an FSM. It boils down nicely.

Oh, a dense but beautiful article on this is Machines in a Category by Arbib and Manes.