GithubHelp home page GithubHelp logo

docker-traffic-counter's Introduction

Docker Traffic Counter

Docker Traffic Counter is a neat little app that counts requests made between services on a micro service platform.

The idea

Once you have a platform with many nice, small micro-services you begin to wonder how they relate to one another. Do they talk to each other? Are the talked to at all? What does my application topology look like for real? This service is supposed to answer those questions. By monitoring requests going from service to service we can figure out how data flows.

This service is build on top of some assumptions:

  1. All services communicate with each other via a proxy. This proxy (usually HAProxy or Nginx) is routing traffic based on the Host header defined in the request.

  2. Data is exported via Prometheus. The handling of Prometheus is plugged into the system, so it should be easy to replace with other exporters.

The Traffic Counter will do some degree of packet inspection in order to figure out what the target host is. All non-HTTP packets (or packets without a host header for that matter) are not taken into account. This tool will therefore not tell you how much traffic is going over the wire. It will however provide you with some insights in which services talk to each other and how often they do that.

To get anything useful, run this container on the host network:

docker run -ti -v /var/run/docker.sock:/var/run/docker.sock --net=host -e PORT=9100 amolenaar/traffic-counter

Building

This is an Elixir project in a Docker container. To build it, simply call

docker build .

Testing

In the test folder you can find a docker-compose file. Lauch this file and you should find that after a couple of seconds, the traffic-counter is scraped (if not check the IP address of the traffic counter and

Note that there is a small caveat there, since the traffic counter runs in host mode. Therefore, if the IP address of the traffic counter container is any different, it should be updated in the prometheus configutation.

Suggestions, improvements are welcome!

Have fun,

Arjan

docker-traffic-counter's People

Contributors

amolenaar avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.