Heartbeat displays user activity on a website. This module is an API to log activity. The logged data contains message structures, attributes and variables. Once the activity messages exist in the database, they will be parsed and build into activity streams.
Logging
Each module can log their own activity streams. This could be done by calling the api functions or by rules. This implicates that other modules, using the rules ui, can be interesting for Heartbeat if activity events and triggers are defined. Great modules that handle user relations like organic groups and friendlist describe rule events.
Display
Heartbeat has global configuration for display, message template configuration and stream configuration. Each stream (or access type) is a class based on HeartbeatAccess. It is basically a query builder (more gracefully in Drupal 7 branch thx to excellent database design) that returns its results to a parser.
The activity messages can be restricted on several levels which means that there are lots of access checks. Because sometimes this debugging is rather hard, heartbeat can now run in debug-mode. This way it's real easy to see why a message is blocked when viewing a stream.