OpenTelemetry Instrumentation for Playwright
Automatic tracing and metrics for your Playwright browser automation scripts using OpenTelemetry.
This package supports both synchronous and asynchronous Playwright APIs, enabling deep observability into your browser automation and testing workflows.
Features
- Automatic tracing of Playwright browser, page, and element actions
- Supports both sync and async Playwright APIs
- Rich span attributes for method arguments and context
- Easy integration with OpenTelemetry SDKs and exporters
- Customizable tracer and meter providers
Getting Started
First, add the mvv-opentelemetry-instrumentation-playwright package as a
dependency.
uv add mvv-opentelemetry-instrumentation-playwright
If you haven't already, make sure Playwright is set up:
uv run playwright install --with-deps
Then, instrument your application:
from opentelemetry.instrumentation.playwright import PlaywrightInstrumentor
import playwright.sync_api
# Instrument Playwright
PlaywrightInstrumentor().instrument()
with playwright.sync_api.sync_playwright() as p:
with p.chromium.launch(headless=True) as browser:
with browser.new_page(user_agent="test", is_mobile=False) as page:
title = page.title()
print("Page title:", title)
This will emit spans like the following:
├── playwright.sync_api._generated.BrowserType:launch {headless: true}
├── playwright.sync_api._generated.Browser:__enter__
| ├── playwright.sync_api._generated.Browser:new_page {user_agent: "test", is_mobile: false}
| ├── playwright.sync_api._generated.Page:__enter__
| | └── playwright.sync_api._generated.Page:title
| └── playwright.sync_api._generated.Page:close
└── playwright.sync_api._generated.Browser:close
You can pass a custom tracer or meter provider:
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.instrumentation.playwright import PlaywrightInstrumentor
provider = TracerProvider()
PlaywrightInstrumentor().instrument(tracer_provider=provider)
To uninstrument (remove all patches):
from opentelemetry.instrumentation.playwright import PlaywrightInstrumentor
instrumentor = PlaywrightInstrumentor()
instrumentor.instrument()
# ...
instrumentor.uninstrument()
Supported Playwright APIs
This package instruments a wide range of methods from the following Playwright classes (sync and async):
BrowserTypeBrowserPageFrameElementHandleLocator
Common actions like launch, new_page, goto, click, type, screenshot,
and many more are traced with relevant attributes.
You can find the full list of methods that are instrumented with the
annotated_methods() function from the
opentelemetry.instrumentation.playwright.targets module.
License
This project is licensed under the MIT License. See the LICENSE.md file for details.
Metadata
Release files for mvv-opentelemetry-instrumentation-playwright 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mvv_opentelemetry_instrumentation_playwright-0.1.4.tar.gz | 12.0 kB | With provenance | Details for mvv_opentelemetry_instrumentation_playwright-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mvv_opentelemetry_instrumentation_playwright-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for mvv_opentelemetry_instrumentation_playwright-0.1.4-py3-none-any.whl |
Total release size: 20.9 kB
Release files / mvv_opentelemetry_instrumentation_playwright-0.1.4.tar.gz
| Download URL | mvv_opentelemetry_instrumentation_playwright-0.1.4.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fe42bf4838ba6b6383b5941d76ad2e2b58e8a8fddbffe471f042c29f585b3ae
|
|
BLAKE2b-256 checksum How to use checksums |
3ff4c45efa72e90b5585b58edc24cb59273b9b724c327c48d9c933621069ce45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2025.
Transparency logRelease files / mvv_opentelemetry_instrumentation_playwright-0.1.4-py3-none-any.whl
| Download URL | mvv_opentelemetry_instrumentation_playwright-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0dd4e462f9e924224b302ad4655496e206ebff26f821251fbc8040004879548
|
|
BLAKE2b-256 checksum How to use checksums |
617dea57b82548baa08d11c1836f75c1c31dc47dc70c7f99da767a65b76ebca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2025.
Transparency logSecurity for mvv-opentelemetry-instrumentation-playwright 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mvv_opentelemetry_instrumentation_playwright-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.