backend reporting via a worker/queue system
Project description
event-reporter
A Python wrapper for backend reporting via a worker/queue system.
System flow:
Store event quickly on webserver [e.g. within a flask endpoint]:
from event_reporter import EventReporter
from redis import StrictRedis
er = EventReporter(conn=StrictRedis())
er.store('ga', 'event', '<uuid4 clientid>', category='event_category', action='action_name', aip='1', uip='1.2.3.4', ds='web')
Fetch event within worker and dispatch to final destination:
from event_reporter import EventReporter
from redis import StrictRedis
er = EventReporter(conn=StrictRedis())
r = er.fetch()
er.dispatch(r)
Env vars used
EVENTREPORTER_QUEUE_NAME
(redis key)UA_ID
(GA UA ID)EVENTREPORTER_TTL
(int: controls whether to set expire time for redis keys)HONEYCOMB_WRITEKEY
(optional)
Testing
export UA_ID='My_UA_ID'
nosetests -s
Dispatch Types
ga
: GAhoney
: honeycomb.ioslack
: slack
Example slack event: Simple message
er.store('slack', 'event', '<uuid4>', webhook='<slack_webhook_uri>', message='text')
Example slack event: Blocks message
er.store('slack', 'event', '<uuid4>', webhook='<slack_webhook_uri>', blocks=<list_of_dicts>)
Example slack blocks format
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello
}
}
]
.. and check your GA property, honeycomb dash, or slack channel to see the data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
event-reporter-1.1.0.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for event_reporter-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb660c4b1aaef4a5148c75be0f871f929fcf16ba63d1cec7f21500e54177eaa |
|
MD5 | 4e3df236c27d2eb21ed5c14f01757cbd |
|
BLAKE2b-256 | aa680ee445a75c226ce7166328b6528e09e533c73e247039790a6365d3bbd7a9 |