pact-foundation / pact_broker

Enables your consumer driven contracts workflow
http://pactflow.io
MIT License
705 stars 173 forks source link

A single network graph of all providers and consumers present in Pact Broker #225

Closed knirski closed 6 years ago

knirski commented 6 years ago

The idea is to have an overview of connections between all systems (consumers and providers) presented on a single network graph.

This would be useful from a point of view of a medium to large sized organization which owns a product consisting of several services working together to achieve a common goal. The organization might be divided into teams who own subsets of services with contracts between them. People who:

might find such an overview (which would always be an updated and accurate description of dependencies between systems) useful.

From the UI point of view, there can be a link on the home page that leads to the network graph in question.

I would like to find out if the maintainers of Pact Broker think this idea is worth implementing in the nearest future (or at all) given their priorities and if not, would a (possible) PR be accepted.

bethesque commented 6 years ago

Hi @knirski. Due to the naivety of the layout logic, trying to graph all the applications in one diagram using the current layout would not scale very well. I would recommend pulling the data out of the broker and using something like graphviz to visualise the relationships. @mefellows had a line that does exactly that, and I've tried to find it because I know I stored it somewhere, but now I can't find it. Have you got it lying around Matt?

mefellows commented 6 years ago

Here's at example for the test broker, extracting out just a subset of data:

echo "digraph { ranksep=3; ratio=auto; overlap=false; node [  shape = plaintext, fontname = "Helvetica" ];" > latest.dot ; curl -v -u 'dXfltyFMgNOFZAxr8io9wJ37iUpY42M:O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1' https://test.pact.dius.com.au/pacts/latest | jq '.pacts[]._embedded | select(.consumer.name | contains("AWSSummiteer")) | .consumer.name + "->" + .provider.name' | tr -d '"' |  sed 's/-/_/g' | sed 's/_>/->/g' >> latest.dot; echo "}" >> latest.dot
dot latest.dot -otest.png -Tpng
knirski commented 6 years ago

Great, thank you very much for the script. I suppose if I wanted something interactive (click on an arrow forwarding to consumer-provider pair pact), graphviz wouldn't be enough. It's still very useful though.

bethesque commented 6 years ago

It wouldn't be hard to do - I just know from experience that it would quickly become too large to be useful to most places. There are broker instances that I know of where the javascript crashes the browser when it tries to render the graph! If you're really interested in it, I can help you make a PR for it.

knirski commented 6 years ago

Thank you very much for the offer - for now the provided method of obtaining such a graph is sufficient. If this somehow came up in the future, I would let you know. Also, I would probably need to brush up on my Ruby skills a bit :). I guess we can close the issue, correct?

bethesque commented 6 years ago

Yes, thanks.