OpenTelemetry is an open-source observability framework that aims to standardize the generation, collection, and management of telemetry data(Logs, metrics, and traces). It is incubated under the Cloud Native Computing Foundation(Cloud Native Computing Foundation), the same foundation that incubated Kubernetes.

In this guide, you will learn how to implement OpenTelemetry in Python Applications. The following lessons cover everything you need to know about using OpenTelemetry to implement observability in Python applications.

What you’ll learn

  1. Setting up a basic Flask application

    In this tutorial, you will create a simple Flask to-do application with MongoDB.

  2. Setting up SigNoz

    OpenTelemetry does not provide a storage and analytics layer. In this tutorial, you will set up SigNoz to send your OpenTelemetry data.

  3. Auto-instrumentation with OpenTelemetry

    Set up automatic traces, metrics, and logs collection in the Flask application.

  4. Manually configuring the agent for instrumentation with OpenTelemetry

    Set up manual instrumentation with OpenTelemetry for more granular controls.

  5. Create spans manually in your Python application

    Create manual spans and add metadata and attributes to them.

  6. Create custom metrics with OpenTelemetry

    Create custom metrics like counter, gauge, and histogram in your application.

  7. Configure OpenTelemetry logging SDK in Python

    Learn how to configure OpenTelemetry logging SDK in Python.

  8. Customize metrics stream produced by OpenTelemetry SDK using views

    Learn how to configure the metrics stream produced by OpenTelemetry.

Tutorial Scope

What you’ll do:

  • Set up OpenTelemetry in a Python application
  • Set up automatic and manual instrumentation
  • Set up logging and custom metrics collection with OpenTelemetry
  • Visualize all data collected with OpenTelemetry in SigNoz

This tutorial series is meant to introduce you to OpenTelemetry and provide practical examples of how to implement it in a Python application.

What we will not cover:

  • In-depth basics of Node.js or Docker.
  • General programming concepts.
  • Non-OpenTelemetry related monitoring techniques.

Pre-requisites

You are expected to have:

  • Basic familiarity with Python/Flask.
  • Basic knowledge of logging, tracing, and monitoring.

Expected Outcomes

By the end of this series, you will be proficient in:

  • Setting up and configuring OpenTelemetry for a Python application to collect traces, metrics, and logs
  • Familiarize yourself with some advanced concepts in OpenTelemetry, like customizing the metrics stream
  • Utilizing SigNoz to visualize OpenTelemetry data.
  • Sample Repo for the project that we will build - OpenTelemetry Python Example

Getting Started

Let’s begin by setting up the sample Flask application that we will use to demonstrate the implementation of OpenTelemetry.

Info

Read Next Article of OpenTelemetry Python series on Setting up a basic Flask application

Was this page helpful?