Skip to main content

Implements a powerful analytics library using Redis bitmaps.

Project description

bitmapist

Implements a powerful analytics library using Redis bitmaps.

This library makes it possible to implement real-time, highly scalable analytics that can answer following questions:

  • Has user 123 been online today? This week? This month?

  • Has user 123 performed action “X”?

  • How many users have been active have this month? This hour?

  • How many unique users have performed action “X” this week?

  • How many % of users that were active last week are still active?

  • How many % of users that were active last month are still active this month?

This library is very easy to use and enables you to create your own reports easily.

Using Redis bitmaps you can store events for millions of users in a very little amount of memory (megabytes). You should be careful about using huge ids (e.g. 2^32 or bigger) as this could require larger amounts of memory.

If you want to read more about bitmaps please read following: * http://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/ * http://redis.io/commands/setbit * http://en.wikipedia.org/wiki/Bit_array * http://www.slideshare.net/crashlytics/crashlytics-on-redis-analytics

Requires Redis 2.6+ and newest version of redis-py.

Examples

Setting things up:

from datetime import datetime, timedelta
from bitmapist import mark_event, MonthEvents

now = datetime.utcnow()
last_month = datetime.utcnow() - timedelta(days=30)

Mark user 123 as active:

mark_event('active', 123)

Answer if user 123 has been active this month:

assert 123 in MonthEvents('active', now.year, now.month)

How many users have been active this week?:

print len(WeekEvents('active', now.year, now.isocalendar()[1]))

Perform bit operations. Which users that have been active last month are still active this month?:

active_2_months = BitOpAnd(
    MonthEvents('active', last_month.year, last_month.month),
    MonthEvents('active', now.year, now.month)
)

Nest bit operations!:

active_2_months = BitOpAnd(
    BitOpAnd(
        MonthEvents('active', last_month.year, last_month.month),
        MonthEvents('active', now.year, now.month)
    ),
    MonthEvents('active', now.year, now.month)
)

Copyright: 2012 by Doist Ltd. Developer: Amir Salihefendic ( http://amix.dk ) License: BSD

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitmapist-1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

bitmapist-1.0.macosx-10.8-intel.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file bitmapist-1.0.tar.gz.

File metadata

  • Download URL: bitmapist-1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bitmapist-1.0.tar.gz
Algorithm Hash digest
SHA256 70146b613abbaa967bcbb14608e2e058b0e15042332404758c8521e17c62e7c0
MD5 0b0448d023887f44fb61af2eb7260ed7
BLAKE2b-256 3f93170415cc5bb9392eb9bbac87f709ce2e60918b8caeaee5e705a6ce00053e

See more details on using hashes here.

Provenance

File details

Details for the file bitmapist-1.0.macosx-10.8-intel.tar.gz.

File metadata

File hashes

Hashes for bitmapist-1.0.macosx-10.8-intel.tar.gz
Algorithm Hash digest
SHA256 bf9fb095b616720ca99b3b47b14560a67fbbbdab29931351e75c4d7b8c6e199f
MD5 c77b285e4f8582410cb23f216e1d9d30
BLAKE2b-256 ab47c7ce1e69acdb16e1755a430a7172655bddaefb0c600f0fa0097cebd027b8

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page