Monitoring your applications is important. You can fix problems before they happen. You can quickly pin-point them if they occur anyway. And you should get a good feel for the application through metrics.
There are three ‘pillars of observability’:
Logging in on a server and searching through logfiles is not much fun. Much better: sentry.
He showed the user interface for an error. You see the line in your python code where the error occurred. Traceback. Statistics about browser types, server names, and so on. How often the error occurred already. When it occurred.
It is easy to integrate. He showed it for flask, django and pure python.
The tool they use is prometheus. A time series database for system and application metrics. Metrics are things like cpu load and memory consumption.
There are different metric types: counters, gauges, histograms, summaries.
Prometheus normally works by pulling data. There are advantages and disadvantages. There is a push gateway, but they don’t use it.
There’s a python client (
prometheus_client). You start its webserver so
that prometheus can talk to it. In your code, you can configure the things you
want to measure (like “request duration”) and then use them as decorators to
decorate your actual functions.
If you want to know more about prometheus, look at https://hynek.me/talks/prometheus/
Photo explanation: some 1:87 scale figures on my model railway (under construction).
My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):