Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
opentelemetry-examples
Example code and resources for working with OpenTelemetry, provided by Lightstep
In my last blog post, I showed y’all how to instrument Python code with OpenTelemetry (OTel), à la auto-instrumentation. You may also recall from that post that I recommended using the Python auto-instrumentation binary even for non-auto-instrumented libraries, because it abstracts all that pesky OTel config stuff so nicely. When you use it, along with any applicable Python auto-instrumentation libraries (installed courtesy of opentelemetry-bootstrap), it takes care of context propagation across related services for you.
Today we learned how to manually configure OpenTelemetry for Python to connect to Lightstep (this also works for any Observability back-end that ingests the OTLP format). We also learned how to link related services together through manual context propagation.
A basic understanding of Python and Python virtual environments
The example in this tutorial can be found in the lightstep/opentelemetry-examples repo. We will be working with three main files:
Note: Although the OpenTelemetry documentation does provide some insight into how to do manual context propagation in Python, the documentation needs a little work. I’m actually part of the OpenTelemetry Comms SIG, so I am using this as motivation to improve the docs around this topic…stay tuned for updates to the OTel docs too! 😎
If you peek over at the terminal running server.py, you will likely notice a super-ugly stack trace. DON’T PANIC! The /ping service makes calls to Redis and MongoDB, and since neither of these services is running, you end up getting some nasty error messages like this:
Related posts
- From Zero to CRUD Hero: Building Your First Backend API in JavaScript
- How to create a dynamic AI Discord bot with TypeScript
- Build a GraphQL API with NodeJS and TypeScript || A Comprehensive Guide
- Create your own AI voice assistant bot with Node.js using Google Bard
- Wtf is Grpc? Part 1: Authentication and Authorization in Flutter and Golang.