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)
Testing
export UA_ID='My_UA_ID'
nosetests -s
Dispatch Types
ga
: GA- 'honey`: honeycomb.io
slack
: 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
Built Distribution
Hashes for event-reporter-1.0.8.macosx-10.14-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bda78c25101591488c74c8d09ae39215f8a1abfe6ba31d25df5c73864e85bb4 |
|
MD5 | a9cdafb186dad11704e54b4b40a644f5 |
|
BLAKE2b-256 | 13aacda75d3827d2f88aae33406a4a3d9f50fddfc1293642b24525d7a2722e9f |
Hashes for event_reporter-1.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 416ef7c76a2fc691e76adb2721463b7cb4afe59ebdf0a1e1d01ef7db1291e0a1 |
|
MD5 | dbfa8aa7c3c1593f63a65f851f48b23e |
|
BLAKE2b-256 | 3c6a1d346873bf23fe03ea213a88b1701e0b6dade590b4c7249b8078905766a3 |