How to set up Elastic APM for Observability (Part 1)

Abdirahman Jama
3 min readDec 7, 2021

--

Do you want a deeper understanding as to what’s actually going on within our distributed systems?

Are you tired of just collecting logs but want a mechanism that enables you to actually transform that data into actionable insights?

If you answered yes to both questions — then you need to look into Observability.

Observability 101

I’ve heard observability called everything from a cool tech buzzword to a “monitoring-on-steroids” must-have. However, there is so much more to it — especially given the way in which systems have increased in complexity over the years.

Historically, it was assumed that only system engineers and operation analysts took an interest in the operational visibility of systems. Nowadays, software engineers, like myself, have taken greater ownership to get this knowledge so we can ultimately provide real value to users/customers and enhance their overall experience.

When we integrate observability into our systems — we can transform our data into actionable insights. Using tools like Dynatrace, Prometheus, Elastic APM — we can identify performance bottlenecks across the entire stack and implement improvements.

In this article, we will simply just play around with Elastic APM and deploy it into your Kubernetes cluster.

Elastic APM

Elastic APM is an application performance monitoring system built on the Elastic Stack. It allows you to monitor software services and applications in real time, collecting detailed performance information on response time for incoming requests, database queries, calls to caches, external HTTP requests.

Core components of Elastic APM:

  • APM Agents
  • APM Server
  • Elastic Search
  • Kibana

(this guide assumes you’re using Kubernetes)

We’re using Helm for this tutorial. Helm is a tool that makes it super easy for us to install and manage our k8s (Kubernetes) applications. Think of it like, yum or brew but for k8s. It uses a format called charts (which is simply a set of files that describes what our k8s resources should look like). You can use these Helm charts to deploy stuff like a redis pod, a whole microservice or your React applications into k8s.

Deploying your APM server

(this guide assumes you’re using Kubernetes and that you’ve got your cluster set up already. I’m also assuming that you’re connected and you’re good to go. If you need to set up a cluster — check out this page on the Kubernetes docs)

  • Create a namespace for your observability stuff:

kubectl create namespace observability

  • Add the Elastic Helm charts repo:

helm repo add elastic https://helm.elastic.co

  • Install the server to your namespace:

helm install apm-server elastic/apm-server

For the purposes of this demo we’ve simply just deployed a default APM server and it is not pointing at any Elasticsearch cluster. In the next article, we will wire everything together and it’ll make sense.

If you want to enhance this — then you can override the values.yml file in the helm chart and actually make it point at your Elasticsearch cluster — you can also add your passwords and stuff but I’d recommend injecting these into the values.yml by using a Kubernetes custom resource (CRD) like SealedSecrets or External Secrets.

Conclusion

Observation is power. As the complexity within our distributed systems advance, having knowledge of how services operate internally and track requests across different services is key to lower the mean time to recovery (MTTR) when an unexpected stuff happens.

It’s great to see that us developers are starting to take Observability under our wing. These are the kind of things that enable us to ultimate deliver real value to our users. The fact that we can gather data, turn it into actionable insights that our businesses can drive decisions from is unreal.

Stay tuned for the next article.

--

--