Creating Experiment Report
In this lesson, we will be using a Docker container to handle dependencies and generating the experiment report.
Now that we have the journal with all the information, let’s convert JSON into something more humanly readable. We’re going to choose PDF, even though we could use some other format. For example, it could be HTML, which is useful if we would like to publish it online. However, we’re going to choose PDF because I will imagine that the goal is to hand over a document, either to your colleagues or to managers.
Now we’re getting to the potentially problematic part.
Docker for handling dependencies#
To create a report, we need to install quite a few dependencies, and they can be tricky to install. Therefore, we’re going to skip trying to figure out all the dependencies we might need to install and configure. Instead, we’re going to run it as a container. To be more precise, we’re going to run a process to create a report through Docker.
Make sure that you have Docker up and running on your laptop. If you don’t have it already, go to the Docker Engine Overview page and install the version for your platform.
Once Docker is up and running, we can create a container that will generate a report based on the journal file we created earlier.
Creating the Docker container and generating report#
The command we are about to execute will be slightly longer than we’re used to. If that’s too much for you and your colleagues, you can convert it into a script, so that it’s a bit easier to run.
Lo and behold, a report was generated.
We executed docker container run
.
The --user
argument made sure that the output file is made by the same user as the one you’re using.
Further on, we used --value
to ensure that the report that we generated inside the container is available on our local hard disk after the container was destroyed. We mounted the current directory ($PWD
) as the volume /tmp/result
.
What also used -it
, which is short for interactive and terminal. That way, we could see the output from that container on the screen.
The image used to create the container is chaostoolkit/reporting
. That is the image created and maintained by the Chaos Toolkit community.
Finally, we specified a few arguments of the entry point command. The first one is report
telling chaos
what we want to create. The --export-format
made sure that it is PDF (it could be something else). Further on, we set the location of the journal (journal-health-http.json
), and the very last argument is the path where the report should be generated (report.pdf
).
We can see from the output that the report
was generated as 'report.pdf'
.
Inspecting the generated report#
Let’s open the newly generated file and see how it looks like.
Remember, if you’re a Windows user, you will need to open the PDF manually if the
open
command that follows does not work. You might need to go to the directory and double click, or do whatever you usually do when opening files in Windows. Mac and Linux users can use theopen
command as-is.
The report should be easier to read than if we observe the data from the journal file. You can send it to your manager and say, “Hey, I generated a report that shows potential problems in our cluster.”
I’ll let you explore the report yourself. You’ll see that it contains all the information we might need in an easy-to-digest format.
The report contains data from a single run of Chaos Toolkit. We’re going to see how we can create reports based on multiple experiments later. For now, we have a single-experiment report.
The next lesson, we will learn how to generate a multi-experiment report.