From the course: Graphite and Grafana: Visualizing Application Performance
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Adding StatsD to an application
From the course: Graphite and Grafana: Visualizing Application Performance
Adding StatsD to an application
- [Instructor] In this section we will look at a StatsD Client library for the Python programming language and show how easy it is to add to a script or application. Here we have the scripts statsd_script_before.py and statsdscript.py. In StatsD script before we see that we have a small script that generates random number between five and 15, prints the number to standard output, then sleeps for that amount of time, repeating forever. Note that this script is to illustrate how to use the StatsD for Python Client and is not necessarily representative of production code. Let's say that we want to add to this script to know how many times the time.sleep method has been run. First we will start up our container running statsd_graphite and grafana. We'll do this by typing sudo docker run -id -p 8000:8000 to expose the port 8000, -p 3000:3000 to expose port 3000, and -p 8125:8125 to do the same for that port /udp because that is the udp protocol instead of tcp. Then we will type the name of…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.