Skip to main content

polars-telemetry

OpenTelemetry instrumentation for Polars query execution.

One span per query carrying the plan, and per-node counters as metrics, to any OTLP collector — or a profile file you open in your browser, with no collector at all.

Both plans, per-node counters and diagnostics for one query in the profile viewer

Install

pip install polars-telemetry          # API only; bring your own OTel SDK
pip install 'polars-telemetry[otlp]'  # with SDK and OTLP exporter

Python 3.10+.

Use

import polars_telemetry

polars_telemetry.install()

install() enables polars' query monitoring, which sets the engine affinity to "streaming" and therefore changes how your queries execute — so it never happens on import. uninstall() reverses it.

What you get

A polars.collect span per query, on whatever trace context was active:

  • the plan — scan sources, pushed-down predicates, join types and keys, group-by keys
  • polars.cpu_ms, polars.parallelism, result rows
  • the hottest node and its share of total CPU
  • diagnostics — parallel efficiency, filter selectivity, join amplification, projection efficiency, morsel skew, predicate pushdown, row-group skipping

Per-node counters — rows, morsels, polls, work-stealing, poll latency, state updates, IO time and bytes — as 15 metric instruments dimensioned by node kind.

Every name is listed in the attribute reference.

Profiles without a collector

from polars_telemetry.export.file import FileExporter

polars_telemetry.install(exporter=FileExporter("profiles/session.jsonl"))

One self-contained JSON document per query: both plans with every node property, all 19 per-node counters, the diagnostics, and a fingerprint of the plan shape.

Drop the file on the profile viewer to read both plans, per-node counters, and a diff between two runs of the same shape. It runs entirely in your browser; nothing is uploaded.

Configure

from polars_telemetry import Config

polars_telemetry.install(Config(node_metrics=False))
Option Default Effect
node_metrics True Read per-node counters once at query end
include_plan False Attach the full plan to the span as JSON
redact_literals False Mask literal values in plan expressions
resource_attributes {} Extra resource attributes

Your data

Spans carry plan detail: scan paths, column names, join keys and literal predicate values — col("email") == "..." arrives verbatim, because knowing which predicate was slow is usually the point.

  • Config(redact_literals=True) masks literal values.
  • Literals are never used as metric attributes, at any setting.
  • Attributes that can carry user data are listed in polars_telemetry.export.semconv.CARRIES_USER_DATA.

Polars Cloud

If polars-cloud is installed, its observer is wrapped and forwarded to rather than replaced. Both work at once.

License

Apache-2.0. See LICENSE and NOTICE.

Metadata

Release files for polars-telemetry 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polars-telemetry 0.1.1
File Size Uploaded
polars_telemetry-0.1.1.tar.gz 421.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polars-telemetry 0.1.1
File Interpreter ABI Platform
polars_telemetry-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 458.2 kB

Release files / polars_telemetry-0.1.1.tar.gz

Download URL polars_telemetry-0.1.1.tar.gz
Size 421.2 kB
Tags Source
SHA-256 checksum
How to use checksums
943408bf8ea283dc449f237034cedb1d8b6fc36030f51a8e15a9d202e4c5c964
BLAKE2b-256 checksum
How to use checksums
2a4e1c3d69d399c417676a83c7bd83ef3ea55c1a12f5dfddac6482f2395da84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 2, 2026.

Transparency log

Release files / polars_telemetry-0.1.1-py3-none-any.whl

Download URL polars_telemetry-0.1.1-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
414db7be4b889dedff50123640fa0673aac0caa042c0b3f24f2cb1109378e0cb
BLAKE2b-256 checksum
How to use checksums
81f09ea9657ac5442bfff871c340bbff1f49c2fea13da3f976e4d8d552e944a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page