{"library":"pytest-opentelemetry","title":"Pytest OpenTelemetry Plugin","description":"pytest-opentelemetry is a pytest plugin that instruments your test runs, exporting detailed span data and timing information via OpenTelemetry. It transforms traditional pass/fail test results into rich, queryable telemetry data, allowing users to analyze test performance, identify slow or flaky tests, and visualize the full test session as a distributed trace. The library is actively maintained, currently at version 1.1.0, with frequent minor releases to add features and improve stability.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pytest-opentelemetry opentelemetry-sdk opentelemetry-exporter-otlp"],"cli":null},"imports":["This is a pytest plugin and automatically registers upon installation. No direct Python imports are typically needed in your test files or conftest.py to enable its core functionality."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nimport os\n\n# A simple test file (e.g., test_example.py)\n\ndef test_success():\n    assert True\n\ndef test_failure():\n    assert False\n\n@pytest.mark.skip(reason=\"demonstrating skip\")\ndef test_skipped():\n    assert True\n\n# To run and see console output:\n# Set environment variables for console exporter for demonstration\n# In a real scenario, you'd point to an OpenTelemetry Collector\n# os.environ['OTEL_TRACES_EXPORTER'] = 'console'\n# os.environ['OTEL_SERVICE_NAME'] = 'my-pytest-suite'\n\n# Then run from your terminal:\n# pytest --export-traces test_example.py -s -v","lang":"python","description":"To quickly get started, install the plugin along with the OpenTelemetry SDK and an OTLP exporter. Create a simple test file. The plugin registers automatically. To activate tracing and export spans, run `pytest` with the `--export-traces` flag. By default, it attempts to export to an OpenTelemetry Collector at `http://localhost:4317` using OTLP gRPC. For a basic demonstration without a collector, configure the `OTEL_TRACES_EXPORTER` environment variable to `console`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"1.1.0","pypi_latest":"1.1.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":6.5,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"64.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":7.1,"import_time_s":null,"mem_mb":null,"disk_size":"63M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"69.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":6.5,"import_time_s":null,"mem_mb":null,"disk_size":"68M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"60.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.2,"import_time_s":null,"mem_mb":null,"disk_size":"59M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"60.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.3,"import_time_s":null,"mem_mb":null,"disk_size":"59M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"63.8M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-opentelemetry","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":8.2,"import_time_s":null,"mem_mb":null,"disk_size":"62M"}]}}