Writing software with observability built-in

Introduction

Either you are in a DevOps world (where your team is responsible for keeping the code running in production) or in a more siloed organization (where operational duties are taken care by other teams), it is your responsibility to write code that it is observable in production. Independently of whom is the responsible to keep the application running, someone within the organization needs to be able to identify errors before the users do.

The objective of this article is to describe some common indicators and metrics that may help you to observe your application in production environment, giving some examples of my past experiences when possible.

Since I’ve used the term “observe” in the previous paragraph, I’ll bring one of the many “-ilities” that you must take into consideration to help me expose my point, which is observability.

Ensuring the observability of a software is a challenging task, that may involve several aspects:

To narrow down the scope of this article and be able to expose practical examples and advices, I’ll focus on metrics and monitoring practices to help increase observability, in the context of one single application or service, and its first downstream dependencies. Talking about monitoring and metrics for integration between many applications could be a separate article.

Also, I’ll consider that you have in place some log aggregation tool (Splunk, LogEntries, ELK or any other) to collect, consolidate and present logs in a friendly manner.

I’ll not cover the responsibilities of create alarms and reacting to incidents. It is a extense topic and could be a separate article.

Types of metrics

There are several metrics or indicators that you can collect, and in the initial stages of your application in production, I advise you to collect all of them and make them visible in radiators or build monitors. If necessary, make a fine tuning and prune some of them later, when you’re application is stable and you are sure you are fine without them.

I’ve categorized them in a few types: