Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Nameko dependency provider that dispatches log data using Events (Pub-Sub).

Project Description
Nameko dependency provider that dispatches log data using Events (Pub-Sub).


Dispatching event log data

Include the EventLogDispatcher dependency in your service class:

from nameko.rpc import rpc
from nameko_eventlog_dispatcher import EventLogDispatcher

class FooService:

    name = 'foo'

    eventlog_dispatcher = EventLogDispatcher()

    def foo_method(self):
          'foo_event_type', {'value': 1}, metadata={'meta': 2}

event_type, event_data (optional) and metadata (optional) can be provided as arguments. Both event_data and metadata must be dictionaries and contain JSON serializable data.

Calling foo_method will dispatch an event from the foo service with log_event as the event type. However foo_event_type will be the event type stored as part of the event metadata.

Then, any nameko service will be able to handle this event.

from import event_handler

class BarService:

    name = 'bar'

    @event_handler('foo', 'log_event')
    def foo_log_event_handler(self, body):
        """`body` will contain the event log data."""

Capturing log data when entrypoints are fired

Enable auto capture event logs in your nameko configuration file:

# config.yaml

  auto_capture: true
  entrypoints_to_exclude: []
  event_type: log_event

All the attributes above are optional and only used to override their default values.

With auto_capture set to true, a nameko event will be dispatched every time an entrypoint is fired:

  • They can also be handled by listening log_event events from the service dispatching them.
  • entrypoint_fired will be the event type stored as part of the event metadata.
  • Only entrypoints listed in the ENTRYPOINT_TYPES_TO_LOG class attribute will be logged.
  • entrypoints_to_exclude can be used to provide a list of entrypoint method names to exclude when firing events automatically.

event_type can be added to the config to override the default nameko event type used to dispatch this kind of events.

Format of the event log data

This is the format of the event log data:

  "entrypoint_name": "foo_method",
  "service_name": "foo",
  "timestamp": "2017-06-12T13:48:16+00:00",
  "event_type": "foo_event_type",  # "entrypoint_fired", ...
  "data": {},
  "call_stack": [
  "entrypoint_protocol": "Rpc",
  "call_id": "foo.foo_method.d7e907ee-9425-48a6-84e6-89db19e3ce50"

The data attribute will contain the event data that was provided as an argument for the event_data parameter when dispatching the event.


It is assumed that RabbitMQ is up and running on the default URL guest:guest@localhost and uses the default ports.

$ make test
$ make coverage

A different RabbitMQ URI can be provided overriding the following environment variables: RABBIT_CTL_URI and AMQP_URI.

Additional pytest parameters can be also provided using the ARGS variable.

$ make test RABBIT_CTL_URI=http://guest:guest@dockermachine:15673 AMQP_URI=amqp://guest:guest@dockermachine:5673 ARGS='-x -vv --disable-pytest-warnings'
$ make coverage RABBIT_CTL_URI=http://guest:guest@dockermachine:15673 AMQP_URI=amqp://guest:guest@dockermachine:5673 ARGS='-x -vv --disable-pytest-warnings'
Release History

Release History

This version
History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nameko_eventlog_dispatcher-0.2.0-py3-none-any.whl (7.6 kB) Copy SHA256 Checksum SHA256 py3 Wheel Jun 23, 2017
nameko-eventlog-dispatcher-0.2.0.tar.gz (5.6 kB) Copy SHA256 Checksum SHA256 Source Jun 23, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting