Docker Stats Example

With Docker stats values

Run the scrips/generate_data.sh, this will produce a data.csv that will be used to create the graphs. You can update it to change the time it runs (by default 30min)

Import the local library then pass the file as parameter.

In [1]:
from src.dockerstats import *

ds = DockerStats("tests/resources/data.csv")
In [2]:
print("The duration time is of \t" + str(ds.duration_min()) + " min")
print("The average cpu is of  \t\t" + str(ds.cpu_avg()) + " %")
print("The average memrory usage is of " + str(ds.memory_avg()) + " %")
The duration time is of 	1.0 min
The average cpu is of  		5.2 %
The average memrory usage is of 0.48 %
In [3]:
ds.mean_for_apps()
Out[3]:
CPU % MEM % MEM Usage PID NET INPUT NET OUTPUT BLOCK INPUT BLOCK OUTPUT
NAME
cautious_bach 5.8 0.56 497.83 1 329.0 3.77 0.31 3.84
determined_mestorf 4.6 0.40 2050.28 1 476.0 4.67 1.00 3.44
In [4]:
ds.plot_category('MEM Usage')

To plot all the interesting graphs (CPU, Memory, Net IO and Block IO)

In [5]:
ds.plot_category_all()

With Jmeter values

If you run jmeter, you can use the .jtl or any .csv report you would like.

Note: You can use default jmeter -g output.csv -o report to generate a report.

In [6]:
from src.jmeter import *
jm = Jmeter("tests/resources/output.jtl")
In [7]:
print("The duration time is of \t\t\t" + str(jm.duration_min()) + " min")
print("The average transaction per second is of \t" + str(jm.tps_avg()) + " tps")
print("The average latency is of  \t\t\t" + str(jm.latency_avg()) + " ms")
print("The average response time is of \t\t" + str(jm.response_time_avg()) + " ms")
The duration time is of 			0.15 min
The average transaction per second is of 	10.9 tps
The average latency is of  			38.569 ms
The average response time is of 		77.211 ms

Plot all the interesting graph

In [8]:
jm.plot_latency()
In [9]:
jm.plot_tps()
In [10]:
jm.plot_both()

Plot depending on the different responseMessage.

In [11]:
jm.plot_success()
In [12]:
jm.plot_label()