vsp-otel 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.
vsp_otel-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: vsp-otel
3
+ Version: 0.1.0
4
+ Summary: Verifiable Span Provenance via OpenTelemetry — real OTLP/gRPC exporter + DSSE/Khipu span processor for the SZL mesh
5
+ Author: SZL Holdings
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/szl-holdings/vsp-otel
8
+ Keywords: opentelemetry,otlp,dsse,provenance,khipu,slsa
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: opentelemetry-api>=1.25.0
13
+ Requires-Dist: opentelemetry-sdk>=1.25.0
14
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.25.0
15
+ Provides-Extra: fastapi
16
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.46b0; extra == "fastapi"
17
+ Provides-Extra: test
18
+ Requires-Dist: pytest>=8.0; extra == "test"
19
+ Requires-Dist: fastapi>=0.115; extra == "test"
20
+ Requires-Dist: httpx>=0.28; extra == "test"
21
+ Requires-Dist: cryptography>=44; extra == "test"
22
+ Requires-Dist: rfc8785==0.1.4; extra == "test"
23
+ Requires-Dist: grpcio>=1.60; extra == "test"
24
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.46b0; extra == "test"
25
+ Dynamic: license-file
26
+
27
+ # vsp-otel — Python operational layer (`vsp_otel`)
28
+
29
+ **Verifiable Span Provenance via OpenTelemetry.** This is the *operational* OTel
30
+ layer for the SZL mesh. It closes the honest gap left by the in-process TypeScript
31
+ exporter: organs could Λ-sign spans **in-process**, but there was **no real OTLP
32
+ wire export and no cross-pod broker**. `vsp_otel` ships:
33
+
34
+ - a **real OTLP/gRPC span exporter** (`opentelemetry-exporter-otlp-proto-grpc`) wired to an OpenTelemetry Collector,
35
+ - a **DSSE-aware span processor** that binds every span into the **Khipu** receipt chain (each span carries `szl.mesh.receipt_hash`; the receipt is DSSE-bound), with an optional `szl.mesh.rekor_log_index` transparency attribute,
36
+ - a **drop-in middleware** (`vsp_otel.middleware.install(app)`) any organ imports,
37
+ - a **cross-pod collector config** (`deploy/otel-collector-config.yaml`) that receives from N organs and exports to Jaeger + Tempo + a SZL custom Khipu exporter.
38
+
39
+ > This `README-python.md` documents the Python layer. The repo's root `README.md`
40
+ > is a historical MOVED-redirect; the Python layer lives under `src/vsp_otel/`.
41
+
42
+ ## Quick start
43
+
44
+ ```bash
45
+ pip install -e ".[test]" # editable install + test extras
46
+ pytest -q # runs the suite incl. a real in-process OTLP/gRPC round-trip
47
+ ```
48
+
49
+ In an organ's `serve.py`:
50
+
51
+ ```python
52
+ import vsp_otel.middleware
53
+ status = vsp_otel.middleware.install(app) # FastAPI/ASGI app
54
+ print(status.as_dict()) # honest report of what was wired
55
+ ```
56
+
57
+ Point organs at the collector via the standard env var:
58
+
59
+ ```bash
60
+ export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
61
+ ```
62
+
63
+ ## Architecture
64
+
65
+ ```
66
+ organ(s) ──OTLP/gRPC──▶ OTel Collector ──▶ Jaeger (UI)
67
+ │ DSSEKhipuSpanProcessor ├▶ Tempo (store)
68
+ │ (receipt_hash, DSSE envelope, └▶ SZL Khipu exporter (DSSE receipts)
69
+ │ Khipu hash-chain, rekor index)
70
+ └─ BatchSpanProcessor → VSPSpanExporter (Welford fan-out variance)
71
+ ```
72
+
73
+ See [`ARCH.md`](ARCH.md) (in the squad workspace) for the full spec, including the
74
+ **DSSE v1 PAE** contract and the formula tie-ins.
75
+
76
+ ## Formula tie-ins (honest)
77
+
78
+ - **Welford** online variance — `exporter.Welford` tracks the variance of **trace fan-out** (spans per export batch) without retaining samples. Live and tested.
79
+ - **PAC-Bayes confidence bound** on aggregated span coverage — *roadmap*: the bound is specified in `ARCH.md`; the runtime currently emits the inputs (coverage counts) but does not yet compute the closed-form bound.
80
+ - **Holevo bound** on a quantum-resistant channel — *roadmap/honest gap*: documented as the capacity ceiling for a future PQ-encrypted OTLP channel; **not** implemented in code.
81
+
82
+ ## Honest gaps (read before claiming anything)
83
+
84
+ 1. **Signer.** The default DSSE signer is a deterministic **HMAC test signer** so the chain is testable offline. It is **NOT** a cosign/ECDSA signature. Production must inject a real signer via `VSPConfig(signer=...)` (the mesh's `szl_dsse` provides one). When no production key is present we keep an honest HMAC marker — we never claim a cosign signature we did not make.
85
+ 2. **Rekor inclusion.** `szl.mesh.rekor_log_index` is stamped **only** when a `rekor_submit` callable is configured. Absent that, the attribute is **omitted** — we never fabricate a transparency-log index.
86
+ 3. **Custom Khipu collector exporter.** The collector pipeline shape is real, but the `szl/khipu` custom exporter requires an `ocb`-built binary; until published, route to the `debug` exporter (the config ships commented + a working `debug` fallback).
87
+ 4. **Docker integration test is opt-in.** `tests/test_integration.py` does a **real in-process OTLP/gRPC round-trip by default** (no Docker). The real-collector-**container** path is gated behind `VSP_OTEL_IT_DOCKER=1` and runs in CI (GitHub Actions has Docker).
88
+ 5. **PAC-Bayes / Holevo** are specified, not yet computed in code (see above).
89
+
90
+ ## Layout
91
+
92
+ ```
93
+ src/vsp_otel/__init__.py # public API, doctrine constants, attr keys
94
+ src/vsp_otel/exporter.py # real OTLP/gRPC exporter + Welford fan-out
95
+ src/vsp_otel/dsse_processor.py # DSSE v1 PAE + Khipu hash-chain SpanProcessor
96
+ src/vsp_otel/middleware.py # install(app) drop-in + honest /vsp/provenance board
97
+ tests/test_exporter.py # mock OTLP receiver asserts export correctness
98
+ tests/test_dsse_binding.py # DSSE v1 PAE well-formedness + chain linking
99
+ tests/test_integration.py # real OTLP/gRPC round-trip (+ opt-in container)
100
+ deploy/otel-collector-config.yaml# cross-pod broker config
101
+ Dockerfile # per-file COPY, minimal slim image
102
+ .github/workflows/python-ci.yml # test matrix + container integration + image build
103
+ ```
104
+
105
+ ---
106
+
107
+ *Doctrine v11 LOCKED — 749 / 14 / 163 · replay hash c7c0ba17 · Λ = Conjecture 1 (NEVER a theorem) · SLSA L1 honest + L2 attested · per-file Dockerfile COPY · DCO. HONESTY OVER CHECKLIST.*
108
+
109
+ *Signed-off-by: Yachay <yachay@szlholdings.ai>*
110
+ *Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>*
@@ -0,0 +1,150 @@
1
+ > **SZL Holdings** · Doctrine v11 · Λ = Conjecture 1 (advisory, never "green"/theorem) · canonical [a-11-oy.com](https://a-11-oy.com)
2
+
3
+ # vsp-otel
4
+
5
+ ## Restored collector contract
6
+
7
+ The maintained `collector/` service accepts **OTLP/HTTP JSON** on `/v1/traces`.
8
+ Its protocol is `application/json`; a default protobuf/gRPC exporter must use an
9
+ appropriate bridge or the separate `src/vsp_otel` library. The HTTP collector
10
+ returns 415 for protobuf instead of claiming unsupported interoperability.
11
+
12
+ - Configure `VSP_FORWARD_ENDPOINT` with the downstream OTLP/HTTP JSON endpoint
13
+ and `VSP_SIGN_KEY_PEM` with an operator-managed ECDSA P-256 private key.
14
+ In Kubernetes use `signing.existingSecret` with key `signing.pem`; never commit
15
+ private key material. Keyless signing is **not implemented**.
16
+ - `/healthz` reports process liveness. `/readyz` returns 503 until the downstream
17
+ endpoint and signing key are configured. Its 200 `CONFIGURED` status establishes
18
+ configuration, with the last delivery attempt reported separately; it does not
19
+ prove downstream availability or deployed source identity.
20
+ - Missing, nonfinite, boolean, or out-of-range governance axes fail closed.
21
+ Clients supply axis evidence; aggregation does not independently establish it.
22
+ - Every forwarded span carries `szl.dsse.receipt`: the complete verifiable DSSE
23
+ envelope. Its subject digest binds the original span, resource and scope through
24
+ [RFC 8785 JSON Canonicalization Scheme](https://www.rfc-editor.org/rfc/rfc8785)
25
+ encoding of `{trace_id, span_id, name, span, resource, scope}`. New receipts use
26
+ predicate type `https://szlholdings.ai/attestations/lambda-gate/v2` and declare
27
+ `subject_canonicalization: "RFC8785"`; historical v1 subjects used Python JSON
28
+ serialization and must not be interpreted as v2. The original
29
+ span excludes collector-added verdict and receipt attributes. Consumers must
30
+ verify the PAE signature against their configured trusted P-256 public key and
31
+ recompute this digest; a receipt hash alone is not signature verification.
32
+ - A downstream transport error returns 503 so the caller can retry. Partial
33
+ governance/downstream rejections return per-request OTLP `rejectedSpans` counts.
34
+ The service has no durable queue or exactly-once guarantee; a lost downstream
35
+ acknowledgement can cause a duplicate on retry. There is no silent acceptance
36
+ when forwarding is unavailable.
37
+
38
+ Run the bounded collector checks with
39
+ `python -m pytest tests/test_collector.py tests/test_collector_delivery.py -q`.
40
+ They use a real loopback downstream fixture and independently verify the receipt
41
+ signature and input digest. Hosted CI, publication, cluster deployment and a live
42
+ estate trace require their own evidence.
43
+
44
+ **Layer 4 (Λ-gate exporter) of the SZL 7-layer architecture.**
45
+ Λ-signed OpenTelemetry exporter for SZL audit fibers.
46
+
47
+ [![tests](https://github.com/szl-holdings/vsp-otel/actions/workflows/tests.yml/badge.svg)](https://github.com/szl-holdings/vsp-otel/actions/workflows/tests.yml)
48
+ &nbsp;Doctrine **v11 LOCKED** · 749 / 14 / 163 · SLSA L1 honest · DOI [10.5281/zenodo.19944926](https://doi.org/10.5281/zenodo.19944926)
49
+
50
+ > **📦 Canonical OTel package (Wave D consolidation).** This standalone repository is the
51
+ > **canonical source of truth** for the Λ-signed OTel exporter. The monorepo copy at
52
+ > [`platform/services/vsp-otel`](https://github.com/szl-holdings/platform/tree/main/services/vsp-otel)
53
+ > is a **non-canonical partial mirror** (it carries `DEPRECATED.md` pointing here) and does
54
+ > **not** contain the deployable collector shipped here (`collector/`, `lambda_gate.py`,
55
+ > `dsse.py`, `stats.py`, Helm chart). Platform should depend on the published `vsp-otel`
56
+ > package rather than mirroring it. An **archived** `szl-otel-mesh` repo is also superseded by
57
+ > this repo. Repos are **not deleted** — archival is a later founder step. Λ = **Conjecture 1**
58
+ > (advisory) is preserved verbatim.
59
+
60
+ ---
61
+
62
+ `vsp-otel` is an **OTLP/HTTP JSON collector exporter shim**. A compatible JSON sender
63
+ can target the collector endpoint. For every span it
64
+ computes a governance Λ, rejects spans below the floor, DSSE-signs the survivors, and
65
+ forwards them to your existing backend (Tempo / Jaeger / any OTLP collector).
66
+
67
+ ```
68
+ your app ──OTLP──▶ vsp-otel ──(Λ ≥ 0.90, DSSE-signed)──▶ Tempo / Jaeger
69
+ (any lang, OTel SDK) :4318
70
+ ```
71
+
72
+ ## Make it real — what landed
73
+
74
+ - **`collector/`** — a deployable OTLP/HTTP collector exporter shim (FastAPI, with a
75
+ stdlib HTTP fallback that still requires the pinned `rfc8785` package):
76
+ - **`lambda_gate.py`** — Λ over span A1–A5 axes; **`LAMBDA_FLOOR = 0.90`** (the
77
+ a11oy doctrine constant); fail-closed rejection.
78
+ - **`dsse.py`** — DSSE in-toto attestation per accepted span (ECDSA P-256 /
79
+ HMAC for direct local tests only; configured P-256 for HTTP ingestion).
80
+ - **`stats.py`** — **Welford** online mean/variance for span latency +
81
+ **HyperLogLog** for unique-trace cardinality.
82
+ - **`app.py`** — `/v1/traces` (OTLP ingest), `/healthz`, `/metrics` (Prometheus).
83
+ - **`Dockerfile`** — per-file `COPY` only (doctrine §build), non-root, SLSA L1 honest (no L2 provenance workflow present).
84
+ - **`deploy/helm/vsp-otel/`** — Helm chart (`helm lint` clean); 2 replicas, security
85
+ context, optional ServiceMonitor, configurable floor + forward endpoint.
86
+ - **`docs/INTEGRATION.md`** — "your existing OTel SDK already works — just point the
87
+ exporter at vsp-otel."
88
+ - **`tests/`** — 9 tests: Λ-gate accept/reject, Welford exactness, HLL cardinality,
89
+ DSSE shape, full OTLP pipeline. All passing.
90
+
91
+ The pre-existing TypeScript runtime (`runtime/`) — the in-process `signSpan` exporter
92
+ and its anchor-formula injection — is unchanged and remains the library form; the new
93
+ `collector/` is the standalone deployable form.
94
+
95
+ ```bash
96
+ pip install -r collector/requirements.txt
97
+ pytest tests/ -v # 9 passed
98
+ uvicorn collector.app:app --port 4318 # run the shim
99
+ curl localhost:4318/healthz # {"status":"ok","lambda_floor":0.9}
100
+ ```
101
+
102
+ ## Verified live (make-real strike, 2026-06-03)
103
+
104
+ Posting two spans (one with A1–A5 = 0.97, one with A1 = 0.4) to a running instance:
105
+
106
+ ```json
107
+ {"received":2,"accepted":1,"rejected":1,"lambda_floor":0.9,
108
+ "unique_traces_est":2,"latency_ms":{"count":2,"mean":3.5,"variance":4.5,"stddev":2.12}}
109
+ ```
110
+
111
+ The high-Λ span passed and was DSSE-signed; the low-A1 span was rejected by the
112
+ geometric-mean gate. `/metrics` exposed `vsp_spans_total`, `vsp_lambda_floor`,
113
+ `vsp_span_latency_ms_mean`, `vsp_unique_traces_estimate`.
114
+
115
+ ## Formal references (lutar-lean — all in OPEN PRs, cite honestly)
116
+
117
+ | Used for | Lean reference | Status |
118
+ |---|---|---|
119
+ | Welford latency mean/variance | [`Lutar.Round11.Welford.welford_mean_exact`, `weightedMean_increment`](https://github.com/szl-holdings/lutar-lean/pull/180) | **theorem** (sorry-free), PR #180 · runtime path: `sentra/runtime/welford_gate.py` (infra dir of the **CHAPAQ** egress immune-inspector; path kept verbatim) |
120
+ | DSSE in-toto attestations | [`Lutar.Round10.CryptoDSSE.dsse_classical_euf_cma`](https://github.com/szl-holdings/lutar-lean/pull/179) | conditional EUF-CMA **theorem** (0 real sorry), PR #179 |
121
+ | Rekor transparency (cosign keyless) | [`Lutar.Round10.CryptoRekor.rekor_inclusion_completeness`](https://github.com/szl-holdings/lutar-lean/pull/179) | completeness **theorem**; soundness is an honest tagged `sorry` (Conjecture 1), PR #179 |
122
+ | Bekenstein throughput ceiling (audit-fiber budget) | [`Lutar.Round10...bekensteinCeiling_mono_E`](https://github.com/szl-holdings/lutar-lean/pull/177) | **theorem** (0 real sorry), PR #177 |
123
+
124
+ > **Λ is Conjecture 1 — never a theorem.** Cited PRs are open on `lutar-lean`. The
125
+ > Λ-gate's geometric-mean aggregation mirrors a11oy's graph-Λ construction but Λ
126
+ > itself remains conjectural. HONESTY OVER CHECKLIST.
127
+
128
+ ## Honest boundaries (disclosed, not hidden — HR-6)
129
+
130
+ - **Cosign keyless** (Fulcio OIDC + Rekor inclusion) is **not implemented** by
131
+ the collector. Configured ECDSA P-256 signs HTTP traffic. Direct local HMAC
132
+ test signatures do not establish configured service readiness.
133
+ - The Λ axis scores are supplied by the instrumented org as span attributes; vsp-otel
134
+ aggregates and gates them — it does not itself infer A1–A5.
135
+
136
+ ## Architecture in context
137
+
138
+ `vsp-otel` (L4) signs and forwards spans that conform to the `szl-otel-mesh` (L5) schemas;
139
+ the receipts it stamps are validated by `hatun-mcp` (L6) `validate-receipt-against-doctrine`.
140
+
141
+ ---
142
+
143
+ *License: Apache-2.0 · © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173*
144
+
145
+ Signed-off-by: Yachay <yachay@szlholdings.ai>
146
+ Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>
147
+
148
+ ---
149
+
150
+ **Explore the SZL estate:** [a11oy console](https://a-11-oy.com) · [LLM Router](https://github.com/szl-holdings/szl-router) · [Receipt format spec](https://github.com/szl-holdings/governed-receipt-spec) · [Lean proofs](https://github.com/szl-holdings/lutar-lean) · [Docs](https://github.com/szl-holdings/docs-site) · [🤗 SZLHOLDINGS](https://huggingface.co/SZLHOLDINGS)
@@ -0,0 +1,44 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # vsp-otel — Verifiable Span Provenance via OpenTelemetry (Python operational layer)
3
+ # Doctrine v11 LOCKED — 749/14/163 · Λ = Conjecture 1
4
+ [build-system]
5
+ requires = ["setuptools>=68", "wheel"]
6
+ build-backend = "setuptools.build_meta"
7
+
8
+ [project]
9
+ name = "vsp-otel"
10
+ version = "0.1.0"
11
+ description = "Verifiable Span Provenance via OpenTelemetry — real OTLP/gRPC exporter + DSSE/Khipu span processor for the SZL mesh"
12
+ readme = "src/vsp_otel/README.md"
13
+ requires-python = ">=3.10"
14
+ license = { text = "Apache-2.0" }
15
+ authors = [{ name = "SZL Holdings" }]
16
+ keywords = ["opentelemetry", "otlp", "dsse", "provenance", "khipu", "slsa"]
17
+
18
+ dependencies = [
19
+ "opentelemetry-api>=1.25.0",
20
+ "opentelemetry-sdk>=1.25.0",
21
+ "opentelemetry-exporter-otlp-proto-grpc>=1.25.0",
22
+ ]
23
+
24
+ [project.optional-dependencies]
25
+ fastapi = ["opentelemetry-instrumentation-fastapi>=0.46b0"]
26
+ test = [
27
+ "pytest>=8.0",
28
+ "fastapi>=0.115",
29
+ "httpx>=0.28",
30
+ "cryptography>=44",
31
+ "rfc8785==0.1.4",
32
+ "grpcio>=1.60",
33
+ "opentelemetry-instrumentation-fastapi>=0.46b0",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/szl-holdings/vsp-otel"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
41
+
42
+ [tool.pytest.ini_options]
43
+ testpaths = ["tests"]
44
+ addopts = "-q"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,84 @@
1
+ # vsp-otel — Python operational layer (`vsp_otel`)
2
+
3
+ **Verifiable Span Provenance via OpenTelemetry.** This is the *operational* OTel
4
+ layer for the SZL mesh. It closes the honest gap left by the in-process TypeScript
5
+ exporter: organs could Λ-sign spans **in-process**, but there was **no real OTLP
6
+ wire export and no cross-pod broker**. `vsp_otel` ships:
7
+
8
+ - a **real OTLP/gRPC span exporter** (`opentelemetry-exporter-otlp-proto-grpc`) wired to an OpenTelemetry Collector,
9
+ - a **DSSE-aware span processor** that binds every span into the **Khipu** receipt chain (each span carries `szl.mesh.receipt_hash`; the receipt is DSSE-bound), with an optional `szl.mesh.rekor_log_index` transparency attribute,
10
+ - a **drop-in middleware** (`vsp_otel.middleware.install(app)`) any organ imports,
11
+ - a **cross-pod collector config** (`deploy/otel-collector-config.yaml`) that receives from N organs and exports to Jaeger + Tempo + a SZL custom Khipu exporter.
12
+
13
+ > This `README-python.md` documents the Python layer. The repo's root `README.md`
14
+ > is a historical MOVED-redirect; the Python layer lives under `src/vsp_otel/`.
15
+
16
+ ## Quick start
17
+
18
+ ```bash
19
+ pip install -e ".[test]" # editable install + test extras
20
+ pytest -q # runs the suite incl. a real in-process OTLP/gRPC round-trip
21
+ ```
22
+
23
+ In an organ's `serve.py`:
24
+
25
+ ```python
26
+ import vsp_otel.middleware
27
+ status = vsp_otel.middleware.install(app) # FastAPI/ASGI app
28
+ print(status.as_dict()) # honest report of what was wired
29
+ ```
30
+
31
+ Point organs at the collector via the standard env var:
32
+
33
+ ```bash
34
+ export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
35
+ ```
36
+
37
+ ## Architecture
38
+
39
+ ```
40
+ organ(s) ──OTLP/gRPC──▶ OTel Collector ──▶ Jaeger (UI)
41
+ │ DSSEKhipuSpanProcessor ├▶ Tempo (store)
42
+ │ (receipt_hash, DSSE envelope, └▶ SZL Khipu exporter (DSSE receipts)
43
+ │ Khipu hash-chain, rekor index)
44
+ └─ BatchSpanProcessor → VSPSpanExporter (Welford fan-out variance)
45
+ ```
46
+
47
+ See [`ARCH.md`](ARCH.md) (in the squad workspace) for the full spec, including the
48
+ **DSSE v1 PAE** contract and the formula tie-ins.
49
+
50
+ ## Formula tie-ins (honest)
51
+
52
+ - **Welford** online variance — `exporter.Welford` tracks the variance of **trace fan-out** (spans per export batch) without retaining samples. Live and tested.
53
+ - **PAC-Bayes confidence bound** on aggregated span coverage — *roadmap*: the bound is specified in `ARCH.md`; the runtime currently emits the inputs (coverage counts) but does not yet compute the closed-form bound.
54
+ - **Holevo bound** on a quantum-resistant channel — *roadmap/honest gap*: documented as the capacity ceiling for a future PQ-encrypted OTLP channel; **not** implemented in code.
55
+
56
+ ## Honest gaps (read before claiming anything)
57
+
58
+ 1. **Signer.** The default DSSE signer is a deterministic **HMAC test signer** so the chain is testable offline. It is **NOT** a cosign/ECDSA signature. Production must inject a real signer via `VSPConfig(signer=...)` (the mesh's `szl_dsse` provides one). When no production key is present we keep an honest HMAC marker — we never claim a cosign signature we did not make.
59
+ 2. **Rekor inclusion.** `szl.mesh.rekor_log_index` is stamped **only** when a `rekor_submit` callable is configured. Absent that, the attribute is **omitted** — we never fabricate a transparency-log index.
60
+ 3. **Custom Khipu collector exporter.** The collector pipeline shape is real, but the `szl/khipu` custom exporter requires an `ocb`-built binary; until published, route to the `debug` exporter (the config ships commented + a working `debug` fallback).
61
+ 4. **Docker integration test is opt-in.** `tests/test_integration.py` does a **real in-process OTLP/gRPC round-trip by default** (no Docker). The real-collector-**container** path is gated behind `VSP_OTEL_IT_DOCKER=1` and runs in CI (GitHub Actions has Docker).
62
+ 5. **PAC-Bayes / Holevo** are specified, not yet computed in code (see above).
63
+
64
+ ## Layout
65
+
66
+ ```
67
+ src/vsp_otel/__init__.py # public API, doctrine constants, attr keys
68
+ src/vsp_otel/exporter.py # real OTLP/gRPC exporter + Welford fan-out
69
+ src/vsp_otel/dsse_processor.py # DSSE v1 PAE + Khipu hash-chain SpanProcessor
70
+ src/vsp_otel/middleware.py # install(app) drop-in + honest /vsp/provenance board
71
+ tests/test_exporter.py # mock OTLP receiver asserts export correctness
72
+ tests/test_dsse_binding.py # DSSE v1 PAE well-formedness + chain linking
73
+ tests/test_integration.py # real OTLP/gRPC round-trip (+ opt-in container)
74
+ deploy/otel-collector-config.yaml# cross-pod broker config
75
+ Dockerfile # per-file COPY, minimal slim image
76
+ .github/workflows/python-ci.yml # test matrix + container integration + image build
77
+ ```
78
+
79
+ ---
80
+
81
+ *Doctrine v11 LOCKED — 749 / 14 / 163 · replay hash c7c0ba17 · Λ = Conjecture 1 (NEVER a theorem) · SLSA L1 honest + L2 attested · per-file Dockerfile COPY · DCO. HONESTY OVER CHECKLIST.*
82
+
83
+ *Signed-off-by: Yachay <yachay@szlholdings.ai>*
84
+ *Co-Authored-By: Perplexity Computer Agent <agent@perplexity.ai>*