GithubHelp home page GithubHelp logo

isabella232 / cctv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vigetlabs/cctv

0.0 0.0 0.0 108 KB

An ultra-performant, DynamoDB-backed activity tracker

License: MIT License

Ruby 100.00%

cctv's Introduction

Gem Version

CCTV

An ultra-performant, DynamoDB-backed activity tracker

CCTV is a simple activity tracker designed for high throughput activity monitoring applications. It persists activity information to DynamoDB, the infinitely scalable, highly performant NoSQL database service offered by Amazon Web Services (AWS).

Data Model

CCTV uses an Actor-Activity-Target data model. Each type of activity is persisted to a separate table within DynamoDB. The "Actor" is a string that uniquely identifies the resource performing the activity. The "Target" is a string that uniquely identifies the recipient or affected resource of the activity. A current UTC epoch timestamp is included with each activity for temporal filtering.

DynamoDB is schemaless database, which means you can also store any additional information you would like within each activity record.

Example Data Model

We want to keeps tabs on website pageviews within our online store.

Bob is a user logged into our application viewing the product page "/store/products/organic-goji-berries". We could record the following pageview activity.

Within table "store-pageviews":

  • Actor: Bob
  • Target: /store/products/organic-goji-berries
  • Timestamp: 1411702475
  • Customer Status: VIP
  • Referred By: AdWords
  • Browser: Chrome

DynamoDB Setup

You have to do things...which I will describe here later.

Example

require 'cctv'

pageview_tracker = Cctv::Tracker.new(
  'my-app-pageviews',
  access_key_id:     'your-aws-access-key-id',
  secret_access_key: 'your-aws-secret-access-key',
  region:            'your-aws-region'
)

pageview_tracker.record_activity('bob', '/store')

pageview_tracker.view_activity('/store', Date.beginning_of_month..Date.today)

Installation

You know the drill. Add the gem to your Gemfile:

gem 'cctv'

Or install via the command line:

gem install cctv

cctv's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.