Git Product home page Git Product logo

docker-k6-influxdb-grafana's Introduction

Sample project showing how to use k6 to load test a simple api with influxdb as a time series data target and grafana for visualizations.

Dependancies:

based on https://github.com/nicolargo/docker-influxdb-grafana

GO minimal API

It uses simple api in GO which binds to :8000 port and exposes /hello endpoint.

Influxdb and Grafana

Influxdb uses default configuration apart from max-body-size which was increased to accept HTTP requests sent from K6 engine running load_test.js script.

Grafana uses provisioning to spin up an instance with automatically configured data source of InfluxDB and default dashboard for K6 - https://grafana.com/dashboards/2587.

Makefile and how to run the sample

To run the sample use make demo. This automatically creates:

  • ephemeral start file to keep file target for Make indicating that start step in the future is not neccessary unless there was a change in the file, to simplify subsequent k6 runs of load_test
  • folders to hold data for Grafana and InfluxDB
  • docker swarm with InfluxDB and Grafana instance
  • load_tests database on InfluxDB
  • compiles minimal go app
  • starts minimal go app in paraller process keeping the PID in file for later kill
  • starts k6 to generate load test data and sends it to InfluxDB

After make run you need to open browser and go to localhost:3000 log in as admin:admin and open the dashboard.

Running custom k6 file

To run custom file with grafana available on port :3000 use make run file=<your_file_path>

Cleanup

To cleanup run make clean - this command:

  • removes data folder with grafana and influxdb data
  • stops docker swarm and removes containers
  • cleans up ephemeral start file

Enjoy :)

docker-k6-influxdb-grafana's People

Contributors

michal-franc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.