Skip to content

Generate graphs from RabbitMQ topology via management API.

Notifications You must be signed in to change notification settings

sldblog/rabbitmq-graph

Repository files navigation

rabbitmq-graph

CircleCI Integration Test Maintainability Test Coverage

Discover RabbitMQ topology.

Assumptions

  • Routing keys are segmented with dots (.).

    Segment name Routing key Extracted Assumed to be
    from_app splitter.experiment.something.assigned splitted The name of the publishing application.
    entity splitter.experiment.something.assigned experiment The entity that is participating in the action.
    actions splitter.experiment.something.assigned something.assigned The action(s) describing the event.
  • Consumer tags are configured to contain the name of the consuming application.

How to run?

Without arguments bin/rabbitmq-graph will connect to localhost:15672 with the default guest user.

How to build/test?

Unit tests:

bundle install
bundle exec rspec

Integration:

docker run -d -p 15672:15672 -p 5672:5672 rabbitmq:3.9-management-alpine
export RABBITMQ_API_URI='http://guest:guest@localhost:15672'
export RABBITMQ_URI='amqp://guest:guest@localhost:5672'
bundle exec rspec --tag=integration
bundle exec bin/rabbitmq-graph

Configuration

Setting Configuration Effect Default
RabbitMQ management URL -uURL
--url=URL
or environment variable
RABBITMQ_API_URI
Specifies the connection URL to RabbitMQ management API http://guest:guest@localhost:15672/
Save topology --save-topology=FILE After discovery save the topology to the given file. disabled
Read topology --read-topology=FILE Skip discovery and use a stored topology file. disabled
Choose format --format=FORMAT Choose an output format. --help will give a list of available options. DotFormat

Dot format specific options

Setting Configuration Effect Default
Show only applications --dot-applications-only Creates a graph without entity nodes. disabled
Label details --dot-label-detail=DETAILS Comma separated segment names to display on labels drawn between applications and/or entities. 'actions'

Show only applications

  • enabled: will only show application to application relations.
  • disabled (default): will show application to entity to application relations. The edge going into the entity and coming out of the entity will have the same label.

Label details

Affects the labeling of edges:

  • 'entity,actions': displays the entity name and the actions on the edge.
  • 'entity': displays the entity name on the edge.
  • 'actions': displays the actions on the edge.
  • '' (empty string): displays no labels.

Any combination and order of the above is allowed.

Example

Running the discovery against a dockerised rabbitmq:3.9-management-alpine:

$ docker run --detach --publish 5672:5672 --publish 15672:15672 rabbitmq:3.9-management-alpine

$ RABBITMQ_API_URI=http://localhost:15672/ bin/rabbitmq-graph > test.dot
I, [2018-04-30T13:05:29.735060 #90042]  INFO -- : connecting to rabbitmq HTTP API (http://guest@127.0.0.1:15672/)
Discovering bindings: |================================================================================================|
Discovering queues: |==================================================================================================|

$ fdp -O -Tpng test.dot   # assumes "graphviz" is installed
$ open test.dot.png

How to configure consumer tags?

hutch

Hutch supports consumer tag prefixes since 0.24.

About

Generate graphs from RabbitMQ topology via management API.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages