Skip to content

Generates a big overview of dependencies between microservices using pact-broker

License

Notifications You must be signed in to change notification settings

ManoManoTech/pact-graph-network

Repository files navigation

Pact graph network

MIT License build status rust

A command line to generate dependency patterns between microservices using pact-broker data.

Available for linux, alpine and OSX.

Broker APIs

  1. First, request $PACT_BROKER_URL/pacts/latest to get the list of all contracts (e.g. pacts) ;

  2. then, for each contract object get the URL to latest version of contract, e.g. _links._self[0].href

    http://$PACT_BROKER_URL/pacts/provider/foo-provide/consumer/bar-consume/latest

  3. and use it to fetch contract details, i.e. all interactions ;

Table of contents

Screenshots

Tech Stack

This project is created with:

Features

  • generate an html report
  • generate an edge bundling chart
  • generate a force directed layout chart
  • exclude sevices with pattern
  • filter only services
  • add support fort Pact Broker authentification (Basic Auth + Bearer Based)

How to install

# Download the binary
VERSION=0.7.2
curl -L -o $HOME/.local/bin/pact-graph-network \
  https://github.com/ManoManoTech/pact-graph-network/releases/download/v${VERSION}/pact-graph-network_x86_64-unknown-linux-gnu

# Make it executable
chmod u+x $HOME/.local/bin/pact-graph-network

Usage

Generate the graph

  pact-graph-network \
  --url https://pact-brocker.your.com/ \
  --output report

View the output in your browser

  open report/edge-bundling.html

Basic Auth

  pact-graph-network --url https://pact-brocker.your.com/ --output report --username $PACT_BROKER_USERNAME --password $PACT_BROKER_PASSWORD

Bearer Auth

  pact-graph-network --url https://pact-brocker.your.com/ --output report --token $PACT_BROKER_TOKEN

Environment Variables

Options

-b, --url <URL>            Pact broker URL
-u, --username <USERNAME>  Pact broker username
-p, --password <PASSWORD>  Pact broker password
-t, --token <TOKEN>        Pact broker token
-o, --output <OUTPUT>      Path of the output dir [default: report]
-g, --graph <GRAPH>        [default: edge] [possible values: edge, directed]
    --timeout <TIMEOUT>    timeout of http request in milliseconds [default: 2000]
    --exclude <EXCLUDE>    list of service to exclude
-h, --help                 Print help information
-V, --version              Print version information

Environment Variables

Key Description Alowed values
PACT_NETWORK_LOG Adds filters to the logger. error,warn,info,debug,trace
PACT_NETWORK_LOG_STYLE Whether or not to print styles to the target. auto, always, never

Feedback

If you have any feedback, please open an issue.

License

MIT