polars-telemetry 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. polars_telemetry-0.1.0/.devcontainer/devcontainer.json +22 -0
  2. polars_telemetry-0.1.0/.github/dependabot.yml +18 -0
  3. polars_telemetry-0.1.0/.github/workflows/canary.yml +72 -0
  4. polars_telemetry-0.1.0/.github/workflows/ci.yml +111 -0
  5. polars_telemetry-0.1.0/.github/workflows/pages.yml +55 -0
  6. polars_telemetry-0.1.0/.github/workflows/release.yml +76 -0
  7. polars_telemetry-0.1.0/.gitignore +31 -0
  8. polars_telemetry-0.1.0/.pre-commit-config.yaml +28 -0
  9. polars_telemetry-0.1.0/CHANGELOG.md +63 -0
  10. polars_telemetry-0.1.0/LICENSE +202 -0
  11. polars_telemetry-0.1.0/NOTICE +7 -0
  12. polars_telemetry-0.1.0/PKG-INFO +154 -0
  13. polars_telemetry-0.1.0/README.md +125 -0
  14. polars_telemetry-0.1.0/SECURITY.md +31 -0
  15. polars_telemetry-0.1.0/docker/Dockerfile +28 -0
  16. polars_telemetry-0.1.0/docker/collector.yaml +31 -0
  17. polars_telemetry-0.1.0/docker/compose.influx.yaml +27 -0
  18. polars_telemetry-0.1.0/docker/compose.yaml +49 -0
  19. polars_telemetry-0.1.0/docker/grafana/dashboards/dashboards.yaml +8 -0
  20. polars_telemetry-0.1.0/docker/grafana/dashboards/polars.json +427 -0
  21. polars_telemetry-0.1.0/docker/grafana/datasources/datasources.yaml +24 -0
  22. polars_telemetry-0.1.0/docker/prometheus.yaml +7 -0
  23. polars_telemetry-0.1.0/docker/telegraf/telegraf.conf +30 -0
  24. polars_telemetry-0.1.0/docs/attributes.md +157 -0
  25. polars_telemetry-0.1.0/docs/compatibility.md +44 -0
  26. polars_telemetry-0.1.0/docs/getting-started.md +94 -0
  27. polars_telemetry-0.1.0/docs/how-it-works.md +66 -0
  28. polars_telemetry-0.1.0/docs/index.md +52 -0
  29. polars_telemetry-0.1.0/docs/influxdb.md +83 -0
  30. polars_telemetry-0.1.0/docs/profiles.md +109 -0
  31. polars_telemetry-0.1.0/docs/releasing.md +98 -0
  32. polars_telemetry-0.1.0/examples/workload.py +136 -0
  33. polars_telemetry-0.1.0/justfile +56 -0
  34. polars_telemetry-0.1.0/mkdocs.yml +39 -0
  35. polars_telemetry-0.1.0/noxfile.py +71 -0
  36. polars_telemetry-0.1.0/pyproject.toml +173 -0
  37. polars_telemetry-0.1.0/src/polars_telemetry/__init__.py +10 -0
  38. polars_telemetry-0.1.0/src/polars_telemetry/_safety.py +83 -0
  39. polars_telemetry-0.1.0/src/polars_telemetry/activation.py +127 -0
  40. polars_telemetry-0.1.0/src/polars_telemetry/adapter/__init__.py +12 -0
  41. polars_telemetry-0.1.0/src/polars_telemetry/adapter/decode.py +120 -0
  42. polars_telemetry-0.1.0/src/polars_telemetry/adapter/handle.py +58 -0
  43. polars_telemetry-0.1.0/src/polars_telemetry/adapter/module.py +71 -0
  44. polars_telemetry-0.1.0/src/polars_telemetry/adapter/observer.py +200 -0
  45. polars_telemetry-0.1.0/src/polars_telemetry/compat.py +130 -0
  46. polars_telemetry-0.1.0/src/polars_telemetry/config.py +30 -0
  47. polars_telemetry-0.1.0/src/polars_telemetry/export/__init__.py +10 -0
  48. polars_telemetry-0.1.0/src/polars_telemetry/export/attributes.py +226 -0
  49. polars_telemetry-0.1.0/src/polars_telemetry/export/base.py +14 -0
  50. polars_telemetry-0.1.0/src/polars_telemetry/export/console.py +53 -0
  51. polars_telemetry-0.1.0/src/polars_telemetry/export/file.py +127 -0
  52. polars_telemetry-0.1.0/src/polars_telemetry/export/otel.py +154 -0
  53. polars_telemetry-0.1.0/src/polars_telemetry/export/profile.py +120 -0
  54. polars_telemetry-0.1.0/src/polars_telemetry/export/semconv.py +94 -0
  55. polars_telemetry-0.1.0/src/polars_telemetry/model/__init__.py +7 -0
  56. polars_telemetry-0.1.0/src/polars_telemetry/model/build.py +54 -0
  57. polars_telemetry-0.1.0/src/polars_telemetry/model/diagnostics.py +125 -0
  58. polars_telemetry-0.1.0/src/polars_telemetry/model/fingerprint.py +53 -0
  59. polars_telemetry-0.1.0/src/polars_telemetry/model/types.py +102 -0
  60. polars_telemetry-0.1.0/src/polars_telemetry/py.typed +0 -0
  61. polars_telemetry-0.1.0/tests/__init__.py +0 -0
  62. polars_telemetry-0.1.0/tests/bench/__init__.py +0 -0
  63. polars_telemetry-0.1.0/tests/bench/test_overhead.py +119 -0
  64. polars_telemetry-0.1.0/tests/conftest.py +15 -0
  65. polars_telemetry-0.1.0/tests/contract/README.md +7 -0
  66. polars_telemetry-0.1.0/tests/contract/__init__.py +0 -0
  67. polars_telemetry-0.1.0/tests/contract/test_golden.py +93 -0
  68. polars_telemetry-0.1.0/tests/contract/test_live.py +84 -0
  69. polars_telemetry-0.1.0/tests/e2e/__init__.py +0 -0
  70. polars_telemetry-0.1.0/tests/e2e/test_end_to_end.py +156 -0
  71. polars_telemetry-0.1.0/tests/fixtures/1.44.2/ir.json +166 -0
  72. polars_telemetry-0.1.0/tests/fixtures/1.44.2/ir.msgpack +1 -0
  73. polars_telemetry-0.1.0/tests/fixtures/1.44.2/meta.json +5 -0
  74. polars_telemetry-0.1.0/tests/fixtures/1.44.2/metrics.json +244 -0
  75. polars_telemetry-0.1.0/tests/fixtures/1.44.2/metrics.msgpack +0 -0
  76. polars_telemetry-0.1.0/tests/fixtures/1.44.2/physical.json +192 -0
  77. polars_telemetry-0.1.0/tests/fixtures/1.44.2/physical.msgpack +0 -0
  78. polars_telemetry-0.1.0/tests/fixtures/README.md +14 -0
  79. polars_telemetry-0.1.0/tests/integration/__init__.py +0 -0
  80. polars_telemetry-0.1.0/tests/integration/test_collector.py +77 -0
  81. polars_telemetry-0.1.0/tests/tools/__init__.py +0 -0
  82. polars_telemetry-0.1.0/tests/tools/capture.py +136 -0
  83. polars_telemetry-0.1.0/tests/unit/__init__.py +0 -0
  84. polars_telemetry-0.1.0/tests/unit/test_attributes.py +158 -0
  85. polars_telemetry-0.1.0/tests/unit/test_build.py +67 -0
  86. polars_telemetry-0.1.0/tests/unit/test_degradation.py +113 -0
  87. polars_telemetry-0.1.0/tests/unit/test_diagnostics.py +76 -0
  88. polars_telemetry-0.1.0/tests/unit/test_docs.py +44 -0
  89. polars_telemetry-0.1.0/tests/unit/test_file_exporter.py +117 -0
  90. polars_telemetry-0.1.0/tests/unit/test_fingerprint.py +58 -0
  91. polars_telemetry-0.1.0/tests/unit/test_package.py +15 -0
  92. polars_telemetry-0.1.0/tests/unit/test_profile.py +79 -0
  93. polars_telemetry-0.1.0/tests/unit/test_safety.py +89 -0
  94. polars_telemetry-0.1.0/uv.lock +1716 -0
  95. polars_telemetry-0.1.0/viewer/index.html +12 -0
  96. polars_telemetry-0.1.0/viewer/package-lock.json +2155 -0
  97. polars_telemetry-0.1.0/viewer/package.json +24 -0
  98. polars_telemetry-0.1.0/viewer/src/App.jsx +253 -0
  99. polars_telemetry-0.1.0/viewer/src/components/Help.jsx +13 -0
  100. polars_telemetry-0.1.0/viewer/src/components/NodeDetails.jsx +117 -0
  101. polars_telemetry-0.1.0/viewer/src/components/PlanNode.jsx +35 -0
  102. polars_telemetry-0.1.0/viewer/src/components/PlanPane.jsx +75 -0
  103. polars_telemetry-0.1.0/viewer/src/lib/format.js +65 -0
  104. polars_telemetry-0.1.0/viewer/src/lib/glossary.js +57 -0
  105. polars_telemetry-0.1.0/viewer/src/lib/layout.js +27 -0
  106. polars_telemetry-0.1.0/viewer/src/lib/storage.js +47 -0
  107. polars_telemetry-0.1.0/viewer/src/main.jsx +7 -0
  108. polars_telemetry-0.1.0/viewer/src/styles.css +172 -0
  109. polars_telemetry-0.1.0/viewer/vite.config.js +16 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "polars-telemetry",
3
+ "build": {
4
+ "dockerfile": "../docker/Dockerfile",
5
+ "context": ".."
6
+ },
7
+ "customizations": {
8
+ "vscode": {
9
+ "extensions": [
10
+ "charliermarsh.ruff",
11
+ "ms-python.python",
12
+ "ms-python.mypy-type-checker"
13
+ ],
14
+ "settings": {
15
+ "python.defaultInterpreterPath": "/workspace/.venv/bin/python",
16
+ "editor.formatOnSave": true,
17
+ "editor.defaultFormatter": "charliermarsh.ruff"
18
+ }
19
+ }
20
+ },
21
+ "postCreateCommand": "uv sync && uv run pre-commit install"
22
+ }
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ cooldown:
8
+ default-days: 7
9
+
10
+ - package-ecosystem: uv
11
+ directory: /
12
+ schedule:
13
+ interval: weekly
14
+ cooldown:
15
+ default-days: 7
16
+ ignore:
17
+ # polars moves with the support window, which is a deliberate, tested act.
18
+ - dependency-name: polars
@@ -0,0 +1,72 @@
1
+ # Early warning for changes to polars' observer interface, which is private and
2
+ # carries no deprecation cycle. Allowed to fail; opens an issue instead.
3
+ name: canary
4
+
5
+ on:
6
+ schedule:
7
+ - cron: "0 5 * * *"
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+ issues: write
13
+
14
+ jobs:
15
+ newest-polars:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
20
+ with:
21
+ enable-cache: true
22
+
23
+ - run: uv sync --locked
24
+
25
+ # Lift the 7-day release quarantine for polars only; seeing new polars
26
+ # early is the point of this job.
27
+ - name: Install newest polars
28
+ run: |
29
+ uv pip install --prerelease=allow --upgrade \
30
+ --exclude-newer-package "polars=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
31
+ polars
32
+ uv run python -c "import polars; print(polars.__version__)"
33
+
34
+ - id: contract
35
+ run: uv run pytest -m "contract and live" -v
36
+
37
+ - run: uv run pytest -m bench
38
+
39
+ - name: Report a broken contract
40
+ if: failure()
41
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
42
+ with:
43
+ script: |
44
+ const title = `canary: polars contract check failed (run ${context.runNumber})`;
45
+ const body = [
46
+ 'The live contract test failed against the newest polars.',
47
+ '',
48
+ `Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
49
+ '',
50
+ 'Check `src/polars_telemetry/adapter/` -- it is the only layer that',
51
+ 'should need changes.',
52
+ ].join('\n');
53
+ // Labels are not created implicitly by the issues API.
54
+ for (const [name, color] of [['canary', 'd93f0b'], ['upstream', '0e8a16']]) {
55
+ try {
56
+ await github.rest.issues.createLabel({
57
+ owner: context.repo.owner, repo: context.repo.repo, name, color,
58
+ });
59
+ } catch (error) {
60
+ if (error.status !== 422) throw error; // 422 = already exists
61
+ }
62
+ }
63
+ const existing = await github.rest.issues.listForRepo({
64
+ owner: context.repo.owner, repo: context.repo.repo,
65
+ state: 'open', labels: 'canary',
66
+ });
67
+ if (existing.data.length === 0) {
68
+ await github.rest.issues.create({
69
+ owner: context.repo.owner, repo: context.repo.repo,
70
+ title, body, labels: ['canary', 'upstream'],
71
+ });
72
+ }
@@ -0,0 +1,111 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ # release.yml re-runs the full suite before publishing.
8
+ workflow_call:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: ci-${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
16
+
17
+ env:
18
+ UV_LOCKED: "1"
19
+
20
+ jobs:
21
+ lint:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
26
+ with:
27
+ enable-cache: true
28
+ - run: uv run ruff check --output-format=github .
29
+ - run: uv run ruff format --check .
30
+
31
+ typecheck:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
36
+ with:
37
+ enable-cache: true
38
+ - run: uv run mypy
39
+
40
+ test:
41
+ runs-on: ubuntu-latest
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ # Corners plus the primary cell. The hook exists only on 1.44.x.
46
+ python: ["3.10", "3.13"]
47
+ polars: ["1.44.1", "1.44.2"]
48
+ include:
49
+ - python: "3.12"
50
+ polars: "1.44.2"
51
+ steps:
52
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
54
+ with:
55
+ enable-cache: true
56
+ python-version: ${{ matrix.python }}
57
+ - run: uv sync --locked
58
+ - run: uv pip install "polars==${{ matrix.polars }}"
59
+ - run: uv run pytest -m "not integration and not bench" --cov --cov-report=xml
60
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
61
+ if: matrix.python == '3.12'
62
+ with:
63
+ name: coverage
64
+ path: coverage.xml
65
+
66
+ integration:
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
70
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
71
+ with:
72
+ enable-cache: true
73
+ - run: docker compose -f docker/compose.yaml up -d --wait
74
+ - run: uv sync --locked
75
+ - run: uv run pytest -m integration
76
+ env:
77
+ OTEL_EXPORTER_OTLP_ENDPOINT: http://localhost:4317
78
+ - if: always()
79
+ run: docker compose -f docker/compose.yaml down -v
80
+
81
+ docs:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
85
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
86
+ with:
87
+ node-version: "22"
88
+ cache: npm
89
+ cache-dependency-path: viewer/package-lock.json
90
+ # The profile viewer is a React Flow app; the docs site ships its build
91
+ # output, which is generated rather than committed.
92
+ - run: npm ci
93
+ working-directory: viewer
94
+ - run: npm run build
95
+ working-directory: viewer
96
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
97
+ with:
98
+ enable-cache: true
99
+ # --strict turns broken links and nav errors into failures.
100
+ - run: uv run --group docs mkdocs build --strict
101
+
102
+ audit:
103
+ runs-on: ubuntu-latest
104
+ steps:
105
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
106
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
107
+ - run: uv sync --locked
108
+ - run: uv run --with pip-audit pip-audit
109
+ - uses: google/osv-scanner-action/osv-scanner-action@a345acffa64b0eaede81a3d9aae6141214d9c8fc # v2.6.0
110
+ with:
111
+ scan-args: --lockfile=uv.lock
@@ -0,0 +1,55 @@
1
+ name: pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "viewer/**"
9
+ - "mkdocs.yml"
10
+ - ".github/workflows/pages.yml"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ # Never cancel a running deploy: a half-published site is worse than a slow one.
17
+ concurrency:
18
+ group: pages
19
+ cancel-in-progress: false
20
+
21
+ jobs:
22
+ build:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
27
+ with:
28
+ node-version: "22"
29
+ cache: npm
30
+ cache-dependency-path: viewer/package-lock.json
31
+ - run: npm ci
32
+ working-directory: viewer
33
+ - run: npm run build
34
+ working-directory: viewer
35
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
36
+ with:
37
+ enable-cache: true
38
+ - run: uv run --group docs mkdocs build --strict
39
+ - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
40
+ - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
41
+ with:
42
+ path: site
43
+
44
+ deploy:
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ permissions:
48
+ pages: write
49
+ id-token: write
50
+ environment:
51
+ name: github-pages
52
+ url: ${{ steps.deploy.outputs.page_url }}
53
+ steps:
54
+ - id: deploy
55
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
@@ -0,0 +1,76 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ verify:
12
+ uses: ./.github/workflows/ci.yml
13
+
14
+ build:
15
+ needs: verify
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
20
+ - run: uv build
21
+ - run: uv run --with twine twine check dist/*
22
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
23
+ with:
24
+ name: dist
25
+ path: dist/
26
+
27
+ testpypi:
28
+ needs: build
29
+ runs-on: ubuntu-latest
30
+ environment: testpypi
31
+ permissions:
32
+ id-token: write
33
+ steps:
34
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
35
+ with:
36
+ name: dist
37
+ path: dist/
38
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
39
+ with:
40
+ repository-url: https://test.pypi.org/legacy/
41
+
42
+ smoke:
43
+ needs: testpypi
44
+ runs-on: ubuntu-latest
45
+ steps:
46
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
47
+ - name: Install from TestPyPI and import
48
+ run: |
49
+ uv venv
50
+ uv pip install --index-url https://test.pypi.org/simple/ \
51
+ --extra-index-url https://pypi.org/simple/ polars-telemetry
52
+ uv run python -c "import polars_telemetry; print(polars_telemetry.__version__)"
53
+
54
+ pypi:
55
+ needs: smoke
56
+ runs-on: ubuntu-latest
57
+ environment: pypi
58
+ permissions:
59
+ id-token: write
60
+ attestations: write
61
+ contents: write
62
+ steps:
63
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
64
+ with:
65
+ name: dist
66
+ path: dist/
67
+ # PEP 740 attestations are generated by the publish action itself.
68
+ # This adds SLSA provenance against the GitHub release artifacts.
69
+ - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
70
+ with:
71
+ subject-path: dist/*
72
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
73
+ - uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
74
+ with:
75
+ generate_release_notes: true
76
+ files: dist/*
@@ -0,0 +1,31 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .venv/
8
+ venv/
9
+
10
+ # Tooling
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .pytest_cache/
14
+ .nox/
15
+ .coverage
16
+ htmlcov/
17
+
18
+ # Data fixtures generated locally
19
+ *.parquet
20
+
21
+ # Docs build output
22
+ site/
23
+
24
+ # Viewer build output — generated from viewer/ by `just viewer`
25
+ docs/viewer/
26
+ viewer/node_modules/
27
+
28
+ # Editors / OS
29
+ .idea/
30
+ .vscode/
31
+ .DS_Store
@@ -0,0 +1,28 @@
1
+ # Pinned to the same versions CI installs.
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v5.0.0
5
+ hooks:
6
+ - id: check-added-large-files
7
+ - id: check-merge-conflict
8
+ - id: check-toml
9
+ - id: check-yaml
10
+ - id: end-of-file-fixer
11
+ exclude: ^tests/fixtures/.*\.(msgpack|json)$
12
+ - id: trailing-whitespace
13
+ exclude: ^tests/fixtures/.*\.(msgpack|json)$
14
+ - id: detect-private-key
15
+
16
+ - repo: https://github.com/astral-sh/ruff-pre-commit
17
+ rev: v0.6.9
18
+ hooks:
19
+ - id: ruff
20
+ args: [--fix]
21
+ - id: ruff-format
22
+
23
+ - repo: https://github.com/pre-commit/mirrors-mypy
24
+ rev: v1.11.2
25
+ hooks:
26
+ - id: mypy
27
+ additional_dependencies: [pytest, msgpack-types]
28
+ pass_filenames: false
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.0] - 2026-10-03
8
+
9
+ ### Added
10
+ - Repository scaffold: packaging, tooling, Docker development stack and CI.
11
+ - MessagePack decoding for the IR plan, physical plan and metrics payloads,
12
+ with contract checks that describe how a payload departs from the known shape.
13
+ - Failure isolation: instrumentation errors are counted, logged once each, and
14
+ disarm the hook past a threshold. Queries are never affected.
15
+ - Fixture capture tool and captured payloads for polars 1.44.2.
16
+ - Contract tests (golden and live) and a degradation suite covering renamed,
17
+ added and retyped fields, corrupt payloads and callback arity changes.
18
+ - `install()` / `uninstall()`: binds the observer factory, enables monitoring,
19
+ probes the installed polars and degrades to query spans only when the plan or
20
+ metrics payloads are not as expected. Delegates to polars-cloud when present.
21
+ - Per-node counters read once when the query ends, with an adaptive settle on
22
+ the closing snapshot rather than a fixed delay.
23
+ - OpenTelemetry exporter emitting one query span with plan-derived attributes,
24
+ plus bounded-dimension metrics per node kind.
25
+ - User-facing attributes are read from the IR plan, which keeps the query's own
26
+ column names; the physical plan rewrites group-by keys and aggregations to
27
+ `_POLARS_TMP_N`.
28
+ - Overhead budget enforced in CI, measured by interleaving instrumented and
29
+ uninstrumented runs so machine drift cancels.
30
+ - Documentation site (MkDocs Material), built with `--strict` in CI, with a
31
+ test asserting the attribute reference documents every declared attribute.
32
+ - `polars.plan.fingerprint`: a hash of the plan *shape*, stable across
33
+ parameter values and bounded by the application's code paths, so it is safe
34
+ as a metric dimension where a query id is not.
35
+ - Derived diagnostics on the span: parallel efficiency, filter selectivity,
36
+ join amplification, projection efficiency, morsel skew, predicate pushdown,
37
+ row-group skipping and table statistics.
38
+ - `polars.metrics.complete`: false when the closing snapshot caught unfinished
39
+ nodes, meaning the counters are a floor rather than a total.
40
+ - Every per-node field polars reports is exported, as 15 node instruments
41
+ covering rows, morsels, polls, work-stealing, poll latency, state updates,
42
+ and IO time and bytes. `largest_morsel` and `io_bytes` carry a `direction`
43
+ dimension rather than one instrument per direction; stolen polls are exported
44
+ as a ratio of total polls, and the per-node completion flag rides on the
45
+ span as `polars.metrics.complete`.
46
+ - `Config(include_plan=True)` attaches the full plan and its counters to the
47
+ span as JSON. Off by default.
48
+ - `FileExporter`: writes one self-contained profile per query to a JSON Lines
49
+ session file, bounded by size with one retained generation. Carries both
50
+ plans with node properties, all 19 counters per node, the diagnostics, the
51
+ fingerprint, and the trace context when a span is active.
52
+ - A client-side profile viewer shipped with the docs site. Loads a session file
53
+ in the browser with no upload, groups runs by fingerprint, renders both plans
54
+ with per-node counters, and compares two runs of the same shape.
55
+ - `ConsoleExporter`: human-readable output for debugging without OTel wiring.
56
+
57
+ ### Notes
58
+ - There are no per-node spans. polars exposes no per-node timestamps, so a node
59
+ interval can only be sampled; sampling measured at 5-15% of query wall time
60
+ and collapsed most nodes onto identical windows. The same counters read once
61
+ at query end are exact and cost nothing measurable.
62
+
63
+ [0.1.0]: https://github.com/jan-krueger/polars-telemetry/releases/tag/v0.1.0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.