EngineeringWiki
  • Introduction
  • Top level Overview of the application
  • FAQs
  • Back End
    • Agent Pipeline
    • Mention Pipeline
    • Profile Pipeline
    • Errors
    • Overview of the Mention/Profile/Cluster Process
    • Adding a New Service
    • Activity and Status Tracking
  • Setup
    • Overview
    • How to Setup Your Local Machine
    • Setup - Cloud Machine
    • Infrastructure
    • Docker
    • Bash Commands
    • Setting up front end in Ubuntu 16.04 desktop
  • Gems/Libraries
    • Bax
    • Creating fixtures for Unit Tests
    • Audienti-Retriever
    • Scour
    • Haystack
    • Audienti-Indexer
    • Audienti-Api
    • Handler
    • Blackbook
    • Allusion
  • Code
    • Multi-step Modal Wizard
    • Structure
    • Audienti DataTables
    • Javascript
      • Passing Props From Root
      • Looping in JS
      • Binding Actions to App
      • CSSTransitionGroup
      • Code Best Practices
      • Reducer Updating an Array with Item in Middle
      • Organizing Javascript
      • Filter Array by Id
    • Design Language
  • Working
    • PostgresSQL
    • S3
    • Terminology
    • Interview Tests
    • Application Descriptions
    • Best Practices
      • Code Organization
      • Code Documentation (using Yard)
      • Git Workflow
      • Tasks and Queues
      • Working in Backend
    • Profiles & Enrichment
      • Profile ID Rules
  • Management
    • API Management
    • Bastion
    • Splash Proxy
    • Rancher
      • OpenVPN Server
      • Traefik Reverse Proxy
  • Teams & Interviews
    • Interview Questions
  • Culture
    • What Makes a World Class Engineer
  • Situational Statuses
    • 2017-11-03
    • 2018-01-09
  • Operations
Powered by GitBook
On this page
  • Structure of an Activity
  • ActivityStatusable
  1. Back End

Activity and Status Tracking

A lot of our application runs on jobs that run regularly. They work, they don't. As such, we need to

  • be able to track these jobs and make sure they complete

  • notify a user of the system if they need to perform some action on behalf of the system (reauthenticate, etc.)

In addition, we also want to, as much as possible, architect a solution that is immutable--so we don't have to have a lot or retrieve/update/push_back cycles in our app, which decrease performance.

To that end, we have

  • a standard mixin that can be mixed into any class: ActivityStatusable.

  • a class that checks the last time something has run successfully or errored (using the Activity table)

  • A immutable class/table (Activity) that keeps track of all the "goings on" in the system. This activity is queried by the front end to show the User what's going on in the system.

Structure of an Activity

An activity has basically a key, and a value. The key is a string, and supports a "x.y" type structure similar to StatsD. By default, depending on the way you make the Activity, it might have an "action." on the front of it. But, the whole idea here is that this is flexible enough for you to put a status update for whatever makes sense.

For example, let's say you are using a Service/OAuth account in our system. When you reconnect to it and validate that its OK, you could add an status update to this:

service.action_status_update('authentication.authenticated', true, 're-authenticated successfully')

What might be confusing is the difference between an 'action' an an activity. The only real difference is that the action is prepended to the key. So, "action.sync" is an action, where "sync" is an update/activity. In practice, there is no difference between these.

There are two other interesting fields on the Activity record: system, and private. If the item is set to system, then its considered a system activity. These may or may not be shown to the end user. If the record is set to private, it should not be shown to the end subscriber.

ActivityStatusable

The ActivityStatusable mixin can be mixed into virtually any object. It provides a number of methods you can use to track things going on in the system. It has a number of helper methods that help you make activity records.

PreviousAdding a New ServiceNextSetup

Last updated 7 years ago