One of our colleagues, Christian, is participating in a tremendous 6-day-run challenge. Yes, you read that right, he will run around 850km (528 miles) over 6 days.
As we like to graph everything, we thought it would be fun to cheer him on remotely and follow his progress in this crazy race via a Datadog dashboard.
Extracting the data
We discovered that Christian’s stats and the race’s progress are regularly updated on the event website.
Since the data is available in plain HTML on the website, scraping his current ranking, total distance run and other data was easy. It involved:
- A simple crawler to scrape the html code of the webpage via the popular Python library Requests
- A basic HTML parser with the Python library BeautifulSoup
Feeding the metrics to Datadog
Now that we had the data, we began emitting metrics using StatsD and the Datadog agent.
from datadog import statsd as dog ci = course_info() for runner in ci: dog.gauge("runner.distance", ci[runner]['distance'], tags=["name:%s" %runner]) dog.gauge("runner.ranking", ci[runner]['ranking'], tags=["name:%s" %runner]) dog.gauge("runner.elapsed_time", ci[runner]['time'], tags=["name:%s" %runner])
With all metrics now available in Datadog, we built a dashboard to support our champion!
We crunched the metrics in order to get a nice dashboard including a live video, a few gifs for fun and some meaningful metrics, and there we are! You can check the dashboard.
We are displaying this around our NY and Paris offices, so we can cheer Christian on throughout the day.
At publishing time, Christian is at the head of the pack, with a lead of over 47km (29 miles) and another 44h to run. Good luck Christian!