--- id: pytest-otel version: "2.4.0" license: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) license_treatment: permissive maintenance: active --- # pytest-otel — OpenTelemetry plugin for Pytest License: permissive · Maintenance: active · Downloads: 89.0K/mo ## What it is and what it does pytest-otel is a pytest plugin that integrates OpenTelemetry tracing into your test runs. It wraps test execution in spans and exports them to an OTLP-compatible backend (such as Jaeger or Elastic APM), allowing you to observe test performance and behavior through your observability stack. The plugin is configured via command-line flags or environment variables and supports both gRPC and HTTP/protobuf OTLP protocols. You provide an OpenTelemetry endpoint URL, service name, and optional headers, then run pytest with the plugin enabled. Each test becomes a span in your trace backend, where you can inspect execution time, failures, and correlate test runs with other system traces. The plugin supports dotenv files for managing configuration and allows trace parent IDs to be passed in for linking to upstream traces. Use it for: - Export test execution traces to Jaeger for visual debugging of slow or flaky tests. - Correlate test failures with application traces in Elastic Stack or other APM tools. - Monitor test suite performance over time by analyzing span data in your observability platform. - Link test execution spans to distributed traces from CI/CD pipelines or deployment systems. - Debug test interactions with external services by viewing spans alongside application instrumentation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A pytest plugin that captures and exports OpenTelemetry spans for each test execution, sending trace data to an OTLP-compatible backend. Yes, if you already run an OpenTelemetry collector and want to observe test execution within your observability stack. The plugin is actively maintained, has low install friction, and is permissively licensed. Install only if you have an OTLP endpoint available and a clear use case for tracing test runs; it adds a runtime dependency on three OpenTelemetry packages and requires Python 3.10+. ## Install pip install pytest-otel uv add pytest-otel poetry add pytest-otel ## Installing pytest-otel Before you install: Low friction install with a pure-Python wheel. Actively maintained as of 46 days ago. Requires pytest and three OpenTelemetry packages (api, sdk, exporter-otlp) as runtime dependencies. License in practice: Apache License 2.0 (permissive) allows free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: pip install pytest-otel pytest --otel-endpoint https://otelcollector.example.com:4317 \ --otel-service-name my_service \ --otel-session-name='My_Test_cases' Requires an OpenTelemetry collector or backend endpoint (--otel-endpoint is mandatory); Python 3.10 or later. Verify before relying: - Whether the plugin automatically instruments all test functions or requires explicit decorator/fixture usage. - Support for distributed tracing context propagation across test suites or CI/CD pipelines. - Performance overhead of span export during test execution. ## Package facts - License: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 89.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest opentelemetry tracing, test span export otlp, pytest observability plugin, test execution tracing, opentelemetry pytest integration, observability, distributed-tracing, testing [View on SkillFed](https://skillfed.io/packages/pytest-otel) · [View on PyPI](https://pypi.org/project/pytest-otel/)