Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. Python Tracker
  6. The RedisWorker class

The RedisWorker class

Important note: Since version 0.9.0, the RedisWorker is only available as an extra module. To use it, you need to install the snowplow-tracker as:

$ pip install snowplow-tracker[redis]

The tracker comes with a RedisWorker class which sends Snowplow events from Redis to an emitter. The RedisWorker constructor is similar to the RedisEmitter constructor:

def __init__(self, _consumer, key=None, dbr=None):
Code language: PHP (php)

This is how it is used:

from snowplow_tracker import AsyncEmitter from snowplow_tracker.redis_worker import RedisWorker e = Emitter("") r = RedisWorker(e, key="snowplow_redis_key")
Code language: JavaScript (javascript)

This will set up a worker which will run indefinitely, taking events from the Redis list with key “snowplow_redis_key” and inputting them to an AsyncEmitter, which will send them to a Cloudfront collector. If the process receives a SIGINT signal (for example, due to a Ctrl-C keyboard interrupt), cleanup will occur before exiting to ensure no events are lost.

If you’d like to learn more about Snowplow Insights you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.