Instrumenting your Python app under Istio

JM Robles
4 min readSep 4, 2022

TL;DR: How to add spans to your Istio traces in Python

Opentelemetry + Python + Istio

Motivation

We discovered how to enable Istio in your Kubernetes cluster in the last post.

Thanks to its auto instrumentation feature out of the box, Istio creates a new trace for each new incoming request. If the request “travels” among some services (pods) in our cluster, each Istio sidecar appends a new span under the trace.

With the Jaeger UI, we can view these traces and their spans.

But what happens if we have to instrument our app to know the SQL to execute in the database, the latency in our handler, or more details about a call to our ML model in production?

Today we discovered how to do it in Python with the Opentelemetry SDK.

Opentelemetry SDK

Opentelemetry is an open-source collection of APIs, formats, libraries, and SDK with the aim to simplify and create a universal observability platform.

--

--

JM Robles
JM Robles

Written by JM Robles

AIOps @ Montevive.ai / Backend / Platform engineer #llm #rag #llamaindex #langchain #go #python #kubernetes #terraform #devops

No responses yet