wizardflow 0.7.1__tar.gz → 0.9.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.
- {wizardflow-0.7.1 → wizardflow-0.9.0}/PKG-INFO +17 -6
- {wizardflow-0.7.1 → wizardflow-0.9.0}/README.md +16 -5
- {wizardflow-0.7.1 → wizardflow-0.9.0}/docs/cli.md +8 -4
- {wizardflow-0.7.1 → wizardflow-0.9.0}/docs/jsonl-file-format.md +4 -1
- wizardflow-0.9.0/docs/opentelemetry.md +471 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/docs/recording.md +86 -12
- {wizardflow-0.7.1 → wizardflow-0.9.0}/pyproject.toml +1 -1
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/__init__.py +45 -9
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/404.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/__next.__PAGE__.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._full.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._head.txt +1 -1
- {wizardflow-0.7.1/src/wizardflow/_ui/why-wizardflow → wizardflow-0.9.0/src/wizardflow/_ui}/__next._index.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._tree.txt +2 -2
- wizardflow-0.7.1/src/wizardflow/_ui/_next/static/chunks/3fxdmyfsnxue6.js → wizardflow-0.9.0/src/wizardflow/_ui/_next/static/chunks/2_iu57vjc6ikq.js +6 -6
- wizardflow-0.7.1/src/wizardflow/_ui/_next/static/chunks/18clj6xsyhc_j.css → wizardflow-0.9.0/src/wizardflow/_ui/_next/static/chunks/301ajw92ycgkd.css +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._full.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._head.txt +1 -1
- {wizardflow-0.7.1/src/wizardflow/_ui → wizardflow-0.9.0/src/wizardflow/_ui/_not-found}/__next._index.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._not-found/__PAGE__.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._not-found.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._tree.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/index.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/index.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/sitemap.xml +1 -1
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._full.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._head.txt +1 -1
- {wizardflow-0.7.1/src/wizardflow/_ui/_not-found → wizardflow-0.9.0/src/wizardflow/_ui/why-wizardflow}/__next._index.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._tree.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next.why-wizardflow/__PAGE__.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next.why-wizardflow.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/cli.py +16 -3
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/client.py +602 -130
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/constants.py +24 -0
- wizardflow-0.9.0/src/wizardflow/otel.py +477 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/otel_file_exporter.py +24 -8
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/otel_mapping.py +130 -23
- wizardflow-0.9.0/tests/helpers.py +74 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/test_cli.py +4 -2
- wizardflow-0.9.0/tests/test_enabled_on_error.py +175 -0
- wizardflow-0.9.0/tests/test_langgraph.py +203 -0
- wizardflow-0.9.0/tests/test_node_lifecycle.py +144 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/test_otel.py +89 -20
- wizardflow-0.9.0/tests/test_otel_error_handling.py +221 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/test_otel_file_exporter.py +14 -4
- wizardflow-0.9.0/tests/test_otel_integration.py +178 -0
- wizardflow-0.9.0/tests/test_persistence.py +106 -0
- wizardflow-0.9.0/tests/test_recording.py +348 -0
- wizardflow-0.9.0/tests/test_reinit.py +141 -0
- wizardflow-0.9.0/tests/test_rotation.py +122 -0
- wizardflow-0.9.0/tests/test_workflow.py +569 -0
- wizardflow-0.7.1/docs/opentelemetry.md +0 -307
- wizardflow-0.7.1/src/wizardflow/otel.py +0 -339
- wizardflow-0.7.1/tests/test_trace.py +0 -1239
- {wizardflow-0.7.1 → wizardflow-0.9.0}/.gitignore +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/CONTRIBUTING.md +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/LICENSE +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/assets/demo.gif +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/data_types.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/multibranch.html +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/multibranch.md +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/multibranch.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/quickstart.html +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/quickstart.md +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/examples/quickstart.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/scripts/build_ui.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/scripts/live_trace_demo.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_render.py +0 -0
- {wizardflow-0.7.1/src/wizardflow/_ui/_next/static/H81QsKAgLXQMK2H6vyBjb → wizardflow-0.9.0/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr}/_buildManifest.js +0 -0
- {wizardflow-0.7.1/src/wizardflow/_ui/_next/static/H81QsKAgLXQMK2H6vyBjb → wizardflow-0.9.0/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr}/_clientMiddlewareManifest.js +0 -0
- {wizardflow-0.7.1/src/wizardflow/_ui/_next/static/H81QsKAgLXQMK2H6vyBjb → wizardflow-0.9.0/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr}/_ssgManifest.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/05-c3ty_6dwfk.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/09s72r58ijxwx.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/0cz1d0mv5g_q7.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/0d1yav018wi6n.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/0fizjutis9uvx.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/14a18doinx71t.css +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/14mrh2-p_w84d.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/1_way7swvumpv.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/1diz-5jfxjm5x.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/1por0fhggxwcm.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2-j1b74l3lxxu.css +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/24c18qa28ilul.css +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/27jktro2p5rq9.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2dclsx_n3obic.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2gj5bmeov-r8f.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2l6srvxdnb-io.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/310vm2bl3xxpt.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/32c7h_m2amh5m.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/352yh6c3r6-0k.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/3n7dm2ojtyzwn.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/3q-c23s8gv3du.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/3rdqn8rx95pw7.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/414c1-tn-1aef.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/43x_68q2b6gcs.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/turbopack-2fblmukzx7kws.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/4fa387ec64143e14-s.2tuy5pz7dlieh.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/53b9e256198e5412-s.390ncx5urfkfu.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/5ce348bf30bf5439-s.31988l_ccedte.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/6306c77e7c8268e4-s.2dbetqa9o8jxf.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/7178b3e590c64307-s.21jp631_3pja2.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/797e433ab948586e-s.p.0r6juujl39pe6.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/7d817b4c03b0c5f1-s.1uyisp29ctx0d.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/8a480f0b521d4e75-s.1qq4vpdcun5oj.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/bbc41e54d2fcbd21-s.1rgnod-3esatf.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/caa3a2e1cccd8315-s.p.0wgildi0cnwt9.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/fef07dbb0973bf53-s.3p2_lha1f2xer.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/icon.09qublg69ek7b.svg +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/icon.svg +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/opengraph-image +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/_ui/robots.txt +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/html.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/markdown.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/py.typed +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/src/wizardflow/reader.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/conftest.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/test_html.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/test_markdown.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.9.0}/tests/test_reader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: wizardflow
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Python SDK for recording agent flows into the WizardFlow / AgentTrace file format.
|
|
5
5
|
Project-URL: Homepage, https://getwizardflow.com
|
|
6
6
|
Project-URL: Documentation, https://getwizardflow.com
|
|
@@ -108,6 +108,12 @@ print(trace_path)
|
|
|
108
108
|
`end_message()` appends the completed message to JSONL. There is no separate
|
|
109
109
|
`save()` call.
|
|
110
110
|
|
|
111
|
+
Recording mistakes such as an unknown node id are logged as warnings rather
|
|
112
|
+
than raised into your app; pass `on_error="raise"` to make them raise (handy in
|
|
113
|
+
tests). Pass `enabled=False`, or set `WIZARDFLOW_ENABLED=false`, to turn tracing
|
|
114
|
+
off while keeping the same API. See
|
|
115
|
+
[docs/recording.md](docs/recording.md#error-handling-on_error).
|
|
116
|
+
|
|
111
117
|
Drop `trace_path` into [getwizardflow.com](https://getwizardflow.com), or open
|
|
112
118
|
it locally:
|
|
113
119
|
|
|
@@ -145,17 +151,22 @@ trace = wizardflow.init(
|
|
|
145
151
|
name="my-agent",
|
|
146
152
|
otel=True,
|
|
147
153
|
otel_endpoint="http://localhost:4318/v1/traces",
|
|
148
|
-
|
|
154
|
+
otel_workflow_name="answer",
|
|
149
155
|
)
|
|
150
156
|
|
|
151
|
-
with trace.
|
|
152
|
-
|
|
153
|
-
node
|
|
157
|
+
with trace.workflow() as run: # one workflow = one OTel trace
|
|
158
|
+
run.set_info(otel_attributes={"session.id": chat_id})
|
|
159
|
+
with run.node("generator", kind="llm") as node:
|
|
160
|
+
node.log_input(input_value)
|
|
161
|
+
node.log_output(output_value)
|
|
154
162
|
|
|
155
|
-
trace.end_message("msg-1")
|
|
156
163
|
trace.close_otel()
|
|
157
164
|
```
|
|
158
165
|
|
|
166
|
+
`otel_attributes` sets exact keys on the workflow's root span — e.g.
|
|
167
|
+
`session.id` groups traces into Phoenix sessions, `langfuse.session.id` into
|
|
168
|
+
Langfuse sessions.
|
|
169
|
+
|
|
159
170
|
Generic logs can optionally choose an exact application-owned span attribute
|
|
160
171
|
without changing their JSONL/UI label:
|
|
161
172
|
|
|
@@ -61,6 +61,12 @@ print(trace_path)
|
|
|
61
61
|
`end_message()` appends the completed message to JSONL. There is no separate
|
|
62
62
|
`save()` call.
|
|
63
63
|
|
|
64
|
+
Recording mistakes such as an unknown node id are logged as warnings rather
|
|
65
|
+
than raised into your app; pass `on_error="raise"` to make them raise (handy in
|
|
66
|
+
tests). Pass `enabled=False`, or set `WIZARDFLOW_ENABLED=false`, to turn tracing
|
|
67
|
+
off while keeping the same API. See
|
|
68
|
+
[docs/recording.md](docs/recording.md#error-handling-on_error).
|
|
69
|
+
|
|
64
70
|
Drop `trace_path` into [getwizardflow.com](https://getwizardflow.com), or open
|
|
65
71
|
it locally:
|
|
66
72
|
|
|
@@ -98,17 +104,22 @@ trace = wizardflow.init(
|
|
|
98
104
|
name="my-agent",
|
|
99
105
|
otel=True,
|
|
100
106
|
otel_endpoint="http://localhost:4318/v1/traces",
|
|
101
|
-
|
|
107
|
+
otel_workflow_name="answer",
|
|
102
108
|
)
|
|
103
109
|
|
|
104
|
-
with trace.
|
|
105
|
-
|
|
106
|
-
node
|
|
110
|
+
with trace.workflow() as run: # one workflow = one OTel trace
|
|
111
|
+
run.set_info(otel_attributes={"session.id": chat_id})
|
|
112
|
+
with run.node("generator", kind="llm") as node:
|
|
113
|
+
node.log_input(input_value)
|
|
114
|
+
node.log_output(output_value)
|
|
107
115
|
|
|
108
|
-
trace.end_message("msg-1")
|
|
109
116
|
trace.close_otel()
|
|
110
117
|
```
|
|
111
118
|
|
|
119
|
+
`otel_attributes` sets exact keys on the workflow's root span — e.g.
|
|
120
|
+
`session.id` groups traces into Phoenix sessions, `langfuse.session.id` into
|
|
121
|
+
Langfuse sessions.
|
|
122
|
+
|
|
112
123
|
Generic logs can optionally choose an exact application-owned span attribute
|
|
113
124
|
without changing their JSONL/UI label:
|
|
114
125
|
|
|
@@ -84,19 +84,23 @@ does not combine an entire rotation chain.
|
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
86
|
wizardflow otel export run.jsonl --endpoint http://localhost:4318/v1/traces
|
|
87
|
-
wizardflow otel export run.jsonl --
|
|
87
|
+
wizardflow otel export run.jsonl --workflow-name consultation
|
|
88
|
+
wizardflow otel export run.jsonl --trace-scope recording
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
This projects an existing artifact through OTLP/HTTP using the same semantic
|
|
91
92
|
mapping as live export. It creates fresh OTel trace IDs and never modifies the
|
|
92
93
|
source file. By default it discovers and exports the complete rotated
|
|
93
|
-
part-chain and creates one
|
|
94
|
-
creates one `wizardflow.
|
|
94
|
+
part-chain and creates one trace per message, rooted at an `invoke_workflow`
|
|
95
|
+
span; `--trace-scope recording` creates one `wizardflow.run` trace for the
|
|
96
|
+
whole chain. Live `otel_attributes` are not stored in JSONL, so exported roots
|
|
97
|
+
do not carry them.
|
|
95
98
|
|
|
96
99
|
| Option | Default | Meaning |
|
|
97
100
|
| --- | --- | --- |
|
|
98
101
|
| `--endpoint` | OTel environment | OTLP/HTTP traces endpoint |
|
|
99
|
-
| `--trace-scope` | `
|
|
102
|
+
| `--trace-scope` | `workflow` | `workflow` (one trace per message) or `recording` trace boundaries |
|
|
103
|
+
| `--workflow-name` | none | Stable `gen_ai.workflow.name` for workflow roots; match the live `otel_workflow_name` |
|
|
100
104
|
| `--include-content` / `--no-include-content` | on | Export or omit bounded input, output, and structured log content |
|
|
101
105
|
| `--content-max-bytes` | `16_384` | Maximum bytes for each exported content value |
|
|
102
106
|
| `--export-graph` | off | Add the WizardFlow graph event to each root |
|
|
@@ -127,13 +127,16 @@ Explicit keys may extend or override semantic mappings. The structural identity
|
|
|
127
127
|
keys `wizardflow.node.id`, `wizardflow.node.kind`, `wizardflow.message.id`, and
|
|
128
128
|
`wizardflow.trace.name` are protected.
|
|
129
129
|
|
|
130
|
+
On an `input` or `output` semantic payload, `otelAttribute` is additive: the
|
|
131
|
+
semantic projection is kept and the value is also exported under that key.
|
|
132
|
+
|
|
130
133
|
`exportToJsonl` is not stored: a record excluded from JSONL is absent.
|
|
131
134
|
|
|
132
135
|
## Source-of-truth rules
|
|
133
136
|
|
|
134
137
|
- JSON-compatible complex values remain intact.
|
|
135
138
|
- JSONL is transport-neutral by default; `otelAttribute` is an optional explicit
|
|
136
|
-
projection hint for generic logs.
|
|
139
|
+
projection hint for generic logs and for input/output payloads.
|
|
137
140
|
- Exporters, rather than the writer, normalize values for their transport.
|
|
138
141
|
- Content truncation for OTel never mutates the JSONL value.
|
|
139
142
|
- Generic labels do not imply semantic meaning.
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
# OpenTelemetry export
|
|
2
|
+
|
|
3
|
+
WizardFlow JSONL is the durable, transport-neutral source of truth.
|
|
4
|
+
OpenTelemetry is an optional projection of the same run for OTLP-compatible
|
|
5
|
+
backends such as Phoenix and Langfuse.
|
|
6
|
+
|
|
7
|
+
WizardFlow emits spans through the traces signal. It does not emit the OTel
|
|
8
|
+
Logs signal or duplicate OpenInference span attributes. A private provider uses
|
|
9
|
+
the OpenInference project resource attribute for backend grouping.
|
|
10
|
+
|
|
11
|
+
Existing JSONL artifacts can also be projected later with the offline exporter.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
The base `wizardflow` package remains dependency-free. Install OTel packages
|
|
16
|
+
directly when enabling export:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Export an existing JSONL artifact
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
wizardflow otel export run.jsonl \
|
|
26
|
+
--endpoint http://localhost:4318/v1/traces \
|
|
27
|
+
--workflow-name consultation
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The command discovers a rotated part-chain even when given a middle part and
|
|
31
|
+
exports all messages in part order. Use `--current-part-only` to export only
|
|
32
|
+
the named file. Input files are never modified.
|
|
33
|
+
|
|
34
|
+
Offline export creates fresh OTel trace IDs; JSONL cannot reconstruct live OTel
|
|
35
|
+
trace IDs or parent contexts. `--trace-scope workflow` (the default) creates one
|
|
36
|
+
new trace per message, rooted at an `invoke_workflow` span built exactly like
|
|
37
|
+
the live one; pass `--workflow-name` to match a live `otel_workflow_name`.
|
|
38
|
+
`--trace-scope recording` creates one new trace rooted at `wizardflow.run`. Both
|
|
39
|
+
modes preserve recorded node timestamps and use the same semantic mapper as
|
|
40
|
+
live export. Application `otel_attributes` are OTel-only and not stored in
|
|
41
|
+
JSONL, so offline roots do not carry them.
|
|
42
|
+
|
|
43
|
+
Content export is enabled by default so the receiving UI shows useful inputs,
|
|
44
|
+
outputs, and structured logs on the first export. Graph export remains opt-in:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
wizardflow otel export run.jsonl --export-graph
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The endpoint may instead come from `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`, or
|
|
51
|
+
from `OTEL_EXPORTER_OTLP_ENDPOINT` with `/v1/traces` appended. Standard OTel
|
|
52
|
+
header environment variables configure authentication. The offline command
|
|
53
|
+
always owns and shuts down a private provider; it never changes the global
|
|
54
|
+
tracer provider.
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import wizardflow
|
|
60
|
+
|
|
61
|
+
trace = wizardflow.init(
|
|
62
|
+
nodes=["classifier", "advisor"],
|
|
63
|
+
name="student-advisor", # project (with otel_endpoint)
|
|
64
|
+
otel=True,
|
|
65
|
+
otel_endpoint="http://localhost:4318/v1/traces",
|
|
66
|
+
otel_trace_scope="workflow", # default
|
|
67
|
+
otel_workflow_name="consultation", # stable workflow type, optional
|
|
68
|
+
otel_attributes={"deployment.environment": "prod"}, # on every root
|
|
69
|
+
otel_include_content=True, # default; set False to omit recorded content
|
|
70
|
+
otel_content_max_bytes=16_384,
|
|
71
|
+
export_graph_to_otel=False,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
with trace.workflow() as run:
|
|
75
|
+
run.set_info(
|
|
76
|
+
title="Degree consultation",
|
|
77
|
+
otel_attributes={"session.id": chat_id, "user.id": user_id},
|
|
78
|
+
)
|
|
79
|
+
with run.node("classifier") as node:
|
|
80
|
+
node.log_input(question)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
How WizardFlow concepts map onto what OTel backends show:
|
|
84
|
+
|
|
85
|
+
| WizardFlow | OTel / backends |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| recording `name` | project (`openinference.project.name` resource, with `otel_endpoint`) |
|
|
88
|
+
| `otel_workflow_name` | workflow type (`gen_ai.workflow.name`) |
|
|
89
|
+
| message = one workflow execution | one trace, rooted at an `invoke_workflow` span |
|
|
90
|
+
| node execution | one span under that root |
|
|
91
|
+
| `otel_attributes` such as `session.id` | session / user grouping of traces |
|
|
92
|
+
|
|
93
|
+
Output modes are independent:
|
|
94
|
+
|
|
95
|
+
| `jsonl` | `otel` | Result |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `True` | `False` | JSONL only |
|
|
98
|
+
| `True` | `True` | JSONL and OTel |
|
|
99
|
+
| `False` | `True` | OTel only |
|
|
100
|
+
| `False` | `False` | In-memory recording only |
|
|
101
|
+
|
|
102
|
+
## Provider ownership
|
|
103
|
+
|
|
104
|
+
Without `otel_endpoint`, WizardFlow obtains a tracer from the application's
|
|
105
|
+
global provider. It never calls `set_tracer_provider()`, adds processors to the
|
|
106
|
+
global provider, or shuts that provider down.
|
|
107
|
+
|
|
108
|
+
With an endpoint, WizardFlow creates a private SDK provider, batch processor,
|
|
109
|
+
and OTLP/HTTP exporter. This isolates WizardFlow configuration from the host
|
|
110
|
+
application. If `name` is set, WizardFlow also uses it as the OpenInference
|
|
111
|
+
project resource name. Backends such as Phoenix therefore group successive
|
|
112
|
+
WizardFlow traces under that project instead of placing them in `default`.
|
|
113
|
+
|
|
114
|
+
Without an endpoint, the application owns the global provider and its resource
|
|
115
|
+
configuration. A resource is fixed per provider, so `name` then does **not**
|
|
116
|
+
become the project: set the project where you configure OTel, for example
|
|
117
|
+
`phoenix.otel.register(project_name="student-advisor")`. Langfuse ignores the
|
|
118
|
+
resource either way; its project comes from the API key.
|
|
119
|
+
|
|
120
|
+
Finish OTel output explicitly:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
trace.close_otel()
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`close_otel()` is idempotent. It ends any active WizardFlow roots, flushes and
|
|
127
|
+
shuts down only a WizardFlow-owned private provider, and leaves JSONL recording
|
|
128
|
+
completely unaffected. After closing, `trace.reinit(otel=True)` can create a
|
|
129
|
+
fresh private provider and trace. If you never call it, WizardFlow closes the
|
|
130
|
+
bridge at process exit.
|
|
131
|
+
|
|
132
|
+
## Failures
|
|
133
|
+
|
|
134
|
+
OTel output is an optional projection of the recording, so, following the
|
|
135
|
+
OpenTelemetry error-handling rules, it never raises into your application at
|
|
136
|
+
run time:
|
|
137
|
+
|
|
138
|
+
- A failure in the OTel bridge or SDK while starting or ending nodes,
|
|
139
|
+
workflows, or runs, or during `reinit()`, is logged as a warning on the
|
|
140
|
+
`wizardflow` logger and recording continues. This holds whatever `on_error`
|
|
141
|
+
is set to, because it isn't a mistake in your code. In particular it never
|
|
142
|
+
replaces an exception your code raises inside `with trace.node(...)`.
|
|
143
|
+
- A flush that doesn't complete in `close_otel()` or at process exit is
|
|
144
|
+
logged as a warning ("some spans may not have been exported"); the provider
|
|
145
|
+
is still shut down.
|
|
146
|
+
- Invalid `otel_attributes` or `otel_attribute` values only drop the OTel
|
|
147
|
+
part. The message or payload is still written to JSONL, and the error is
|
|
148
|
+
then warned about or raised per `on_error`.
|
|
149
|
+
|
|
150
|
+
Startup is the exception: missing OTel packages raise
|
|
151
|
+
`OTelConfigurationError` from `init()`. The offline `wizardflow otel export`
|
|
152
|
+
command raises `OTelExportError` when its final flush fails, so a CLI run can't
|
|
153
|
+
report success for an incomplete export.
|
|
154
|
+
|
|
155
|
+
## Trace scope, shape, and timestamps
|
|
156
|
+
|
|
157
|
+
A trace is the collection of spans that share one trace ID. `otel_trace_scope`
|
|
158
|
+
controls where WizardFlow draws that boundary:
|
|
159
|
+
|
|
160
|
+
| Value | Trace boundary |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| `"workflow"` (default) | One independent trace per workflow execution (WizardFlow message), rooted at an `invoke_workflow` span |
|
|
163
|
+
| `"recording"` | One trace from initialization or OTel reinitialization until the next reinitialization or `close_otel()` |
|
|
164
|
+
|
|
165
|
+
Workflow scope is the standard request-oriented model used by Phoenix,
|
|
166
|
+
Langfuse, and the GenAI semantic conventions, and the only scope that supports
|
|
167
|
+
session grouping. Recording scope is a specialized whole-recording view: its
|
|
168
|
+
root stays open until `close_otel()` or process exit, and backends show it as
|
|
169
|
+
incomplete until then.
|
|
170
|
+
|
|
171
|
+
In workflow scope, every workflow execution maps to one trace. The root follows
|
|
172
|
+
the OTel GenAI `invoke_workflow` span convention (currently marked
|
|
173
|
+
Development):
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
invoke_workflow consultation INTERNAL root span
|
|
177
|
+
├── classifier node span
|
|
178
|
+
└── advisor node span
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The root span carries:
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
gen_ai.operation.name = "invoke_workflow"
|
|
185
|
+
gen_ai.workflow.name = "consultation" # only with otel_workflow_name
|
|
186
|
+
wizardflow.message.id = <generated or caller-provided message id>
|
|
187
|
+
wizardflow.message.title = "Degree consultation" # when a title is supplied
|
|
188
|
+
wizardflow.message.metadata = <deterministic JSON> # when meta is supplied
|
|
189
|
+
<otel_attributes> # init-level, then per-workflow
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The `invoke_workflow` span is the root operation, not a separate trace object.
|
|
193
|
+
Without `otel_workflow_name` it is named just `invoke_workflow` and omits
|
|
194
|
+
`gen_ai.workflow.name`; WizardFlow never invents a workflow name. The workflow
|
|
195
|
+
name is a stable, low-cardinality type, configured once. The per-execution
|
|
196
|
+
title never renames the root.
|
|
197
|
+
|
|
198
|
+
`trace.workflow()` starts the root when the block begins and makes it the
|
|
199
|
+
current span, so auto-instrumented calls inside the block (HTTP clients, model
|
|
200
|
+
SDKs) are parented under it. Leaving the block ends it. If the block raises,
|
|
201
|
+
the root records the exception, sets `error.type`, and gets error status; the
|
|
202
|
+
exception still propagates.
|
|
203
|
+
|
|
204
|
+
The lower-level `message_id` / `end_message()` API produces the same shape: the
|
|
205
|
+
root is created lazily from the first node's start time and ended by
|
|
206
|
+
`end_message()`. Ending a message that never ran a node still emits a
|
|
207
|
+
zero-child root. Overlapping message IDs remain independent traces, each with
|
|
208
|
+
its own root and context. `close_otel()` ends roots that were never finished
|
|
209
|
+
with unset status, since no failure was observed.
|
|
210
|
+
|
|
211
|
+
In recording scope, one active WizardFlow OTel recording maps to one trace
|
|
212
|
+
rooted at `wizardflow.run`, and `trace.workflow()` does not create extra roots:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
wizardflow.run
|
|
216
|
+
├── researcher wizardflow.message.id=m1
|
|
217
|
+
├── model wizardflow.message.id=m1
|
|
218
|
+
└── model wizardflow.message.id=m2
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Every node span carries:
|
|
222
|
+
|
|
223
|
+
```text
|
|
224
|
+
wizardflow.message.id
|
|
225
|
+
wizardflow.node.id
|
|
226
|
+
wizardflow.node.kind
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Node spans use the resolved WizardFlow `timestamp` and `endTimestamp`, rather
|
|
230
|
+
than the time at which an exporter happens to process them. Workflow scope and
|
|
231
|
+
recording scope only change OTel trace boundaries; JSONL files and rotation are
|
|
232
|
+
unaffected.
|
|
233
|
+
|
|
234
|
+
### Span granularity
|
|
235
|
+
|
|
236
|
+
WizardFlow uses one span for each node execution. This is similar to the
|
|
237
|
+
operation-oriented model used by GenAI tracing systems such as
|
|
238
|
+
Phoenix/OpenInference, where an agent invocation, model call, retrieval, or
|
|
239
|
+
tool execution is represented by a span. The boundaries are not necessarily
|
|
240
|
+
identical: WizardFlow can only describe the node execution it records.
|
|
241
|
+
|
|
242
|
+
When one node execution represents one logical operation, the resulting span
|
|
243
|
+
has the expected operation-level granularity. When a node internally performs
|
|
244
|
+
several model or tool calls, WizardFlow still exports one node span; those
|
|
245
|
+
internal calls require their own instrumentation to appear as child spans.
|
|
246
|
+
This is a difference in detail, not an OTLP compatibility issue. The receiving
|
|
247
|
+
backend can still ingest and display the WizardFlow spans normally.
|
|
248
|
+
|
|
249
|
+
## Application attributes on the workflow root
|
|
250
|
+
|
|
251
|
+
`otel_attributes` sets exact, application-chosen keys on workflow root spans.
|
|
252
|
+
It is the counterpart of `log(otel_attribute=...)` for the execution as a
|
|
253
|
+
whole, and the way to make traces groupable by backends:
|
|
254
|
+
|
|
255
|
+
| Purpose | Phoenix / OpenInference | Langfuse | GenAI semconv |
|
|
256
|
+
| --- | --- | --- | --- |
|
|
257
|
+
| Session / conversation | `session.id` | `langfuse.session.id` (or `session.id`) | `gen_ai.conversation.id` |
|
|
258
|
+
| User | `user.id` | `langfuse.user.id` (or `user.id`) | — |
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
trace = wizardflow.init(..., otel_attributes={"deployment.environment": "prod"})
|
|
262
|
+
|
|
263
|
+
with trace.workflow() as run:
|
|
264
|
+
run.set_info(otel_attributes={"session.id": chat_id, "user.id": user_id})
|
|
265
|
+
...
|
|
266
|
+
|
|
267
|
+
# Low-level form:
|
|
268
|
+
trace.end_message(message_id, otel_attributes={"session.id": chat_id})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
- `init()` / `reinit()` values apply to every workflow root started afterwards
|
|
272
|
+
(in recording scope, to the recording root).
|
|
273
|
+
- `set_info()` / `end_message()` values apply to that workflow's root only and
|
|
274
|
+
override init-level values for the same key. Repeated `set_info()` calls
|
|
275
|
+
merge.
|
|
276
|
+
- Keys are used exactly, with the same rules as `otel_attribute` (non-empty, no
|
|
277
|
+
surrounding whitespace or control characters). The keys WizardFlow sets on
|
|
278
|
+
the root are protected: `gen_ai.operation.name`, `gen_ai.workflow.name`,
|
|
279
|
+
`wizardflow.message.id`, `wizardflow.message.title`,
|
|
280
|
+
`wizardflow.message.metadata`, plus the node identity keys.
|
|
281
|
+
- Values must be `str`, `bool`, `int`, `float`, or a non-empty list of one of
|
|
282
|
+
those types. Invalid entries are dropped with a warning, or raise with
|
|
283
|
+
`on_error="raise"`. Either way the valid entries are kept and the message
|
|
284
|
+
is still written to JSONL first.
|
|
285
|
+
- They are identifiers the application chose, so they are exported even with
|
|
286
|
+
`otel_include_content=False`.
|
|
287
|
+
- They are OTel-only: JSONL never stores them, and the offline exporter cannot
|
|
288
|
+
reproduce them.
|
|
289
|
+
- In recording scope there is no per-workflow root. Per-workflow
|
|
290
|
+
`otel_attributes` are ignored with one warning rather than attached to the
|
|
291
|
+
recording root, because backends treat session and user as properties of the
|
|
292
|
+
whole trace.
|
|
293
|
+
- They are set on the root span only. Langfuse notes that filtering *spans* by
|
|
294
|
+
these attributes requires them on every span; session grouping of traces
|
|
295
|
+
works from the root.
|
|
296
|
+
|
|
297
|
+
`meta` stays separate: it is exported as one bounded JSON value,
|
|
298
|
+
`wizardflow.message.metadata`, and its keys are never turned into attribute
|
|
299
|
+
names.
|
|
300
|
+
|
|
301
|
+
## GenAI semantic projection
|
|
302
|
+
|
|
303
|
+
Use an execution kind only when it accurately describes the node:
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
with trace.node(message_id, "model", kind="llm") as node:
|
|
307
|
+
node.log_input(messages)
|
|
308
|
+
node.log_model_parameters(model="gpt-5", temperature=0.7)
|
|
309
|
+
node.log_output(response)
|
|
310
|
+
node.log_usage(input_tokens=120, output_tokens=30)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Current conservative mapping:
|
|
314
|
+
|
|
315
|
+
| Kind | Standard projection |
|
|
316
|
+
| --- | --- |
|
|
317
|
+
| generic | Custom `wizardflow.*` attributes only |
|
|
318
|
+
| `llm` | GenAI content, compatible request parameters, and usage; no guessed operation name |
|
|
319
|
+
| `agent` | `gen_ai.operation.name=invoke_agent`, agent name, compatible content/metadata |
|
|
320
|
+
| `tool` | `gen_ai.operation.name=execute_tool`, tool name, valid argument/result objects |
|
|
321
|
+
| `retriever` | `gen_ai.operation.name=retrieval`, string query and valid document-list content |
|
|
322
|
+
| `embedding` | `gen_ai.operation.name=embeddings`, compatible model and input-token metadata |
|
|
323
|
+
| `reranker` | Custom attributes; no current standardized operation is invented |
|
|
324
|
+
|
|
325
|
+
`log_input()` and `log_output()` do not create GenAI fields on a generic node.
|
|
326
|
+
The mapper needs both a compatible node kind and an explicit semantic record.
|
|
327
|
+
|
|
328
|
+
Recognized model parameters map to compatible `gen_ai.request.*` attributes.
|
|
329
|
+
Unknown or unsupported parameters remain readable under
|
|
330
|
+
`wizardflow.model_parameter.*`.
|
|
331
|
+
|
|
332
|
+
## Generic payloads
|
|
333
|
+
|
|
334
|
+
Arbitrary scalar payloads (generic `log()` records) export by default as custom
|
|
335
|
+
span attributes. They are named `payload`, not `log`, because OTel "logs" are
|
|
336
|
+
the separate Logs signal:
|
|
337
|
+
|
|
338
|
+
```text
|
|
339
|
+
wizardflow.payload.confidence = 0.91
|
|
340
|
+
wizardflow.payload.retrieval = "..."
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Duplicate normalized labels preserve the first unsuffixed:
|
|
344
|
+
|
|
345
|
+
```text
|
|
346
|
+
wizardflow.payload.retrieval
|
|
347
|
+
wizardflow.payload.retrieval.1
|
|
348
|
+
wizardflow.payload.retrieval.2
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
For an exact application-owned attribute key, generic `log()` accepts
|
|
352
|
+
`otel_attribute`:
|
|
353
|
+
|
|
354
|
+
```python
|
|
355
|
+
node.log(
|
|
356
|
+
"retrieval_results",
|
|
357
|
+
documents,
|
|
358
|
+
otel_attribute="app.main.retrieval",
|
|
359
|
+
)
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
The developer-facing JSONL/UI label remains `retrieval_results`, while the span
|
|
363
|
+
attribute is exactly `app.main.retrieval`. The override is persisted as
|
|
364
|
+
`otelAttribute`, so live and offline export agree. Explicit keys are not
|
|
365
|
+
normalized. They must be non-empty, contain no surrounding whitespace or
|
|
366
|
+
control characters. Explicit values are applied after automatic mappings, so
|
|
367
|
+
they may intentionally extend or override `gen_ai.*` and WizardFlow attributes.
|
|
368
|
+
Only `wizardflow.node.id`, `wizardflow.node.kind`, `wizardflow.message.id`, and
|
|
369
|
+
`wizardflow.trace.name` are protected because changing them would make the span
|
|
370
|
+
contradict its recorded execution. If the same explicit key is logged more than
|
|
371
|
+
once during one node execution, the last value wins and export emits a warning.
|
|
372
|
+
|
|
373
|
+
This option does not bypass content controls or truncation. Prefer the semantic
|
|
374
|
+
logging helpers for inputs, outputs, usage, model parameters, and compatible
|
|
375
|
+
retrieval data; the custom key is an escape hatch for application-specific
|
|
376
|
+
attributes.
|
|
377
|
+
|
|
378
|
+
### Exact keys for inputs and outputs
|
|
379
|
+
|
|
380
|
+
`log_input()` and `log_output()` accept `otel_attribute` too. There it is
|
|
381
|
+
**additive**: the automatic projection (`gen_ai.input.messages`, tool
|
|
382
|
+
arguments, and so on) is kept, and the same value is also exported under the
|
|
383
|
+
exact key. The record stays one JSONL payload, with `otelAttribute` persisted
|
|
384
|
+
so offline export agrees:
|
|
385
|
+
|
|
386
|
+
```python
|
|
387
|
+
node.log_input(question, otel_attribute="input.value")
|
|
388
|
+
node.log_output(answer, otel_attribute="output.value")
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
This is useful for backends that read other keys than `gen_ai.*`. Phoenix, for
|
|
392
|
+
example, fills its span Input/Output panels from the OpenInference keys
|
|
393
|
+
`input.value` / `output.value`. Because inputs and outputs are content, the
|
|
394
|
+
extra key follows `otel_include_content` (even for plain strings) and
|
|
395
|
+
`otel_content_max_bytes`. The same key rules, protected keys, and
|
|
396
|
+
last-value-wins warning as for generic logs apply.
|
|
397
|
+
|
|
398
|
+
WizardFlow never guesses GenAI semantics from a generic label. A record with
|
|
399
|
+
`export_to_otel=False` is never exported.
|
|
400
|
+
|
|
401
|
+
## Content privacy and size bounds
|
|
402
|
+
|
|
403
|
+
Content export is enabled by default once OTel export itself is enabled. This
|
|
404
|
+
can include prompts, responses, retrieved documents, and tool results. Use
|
|
405
|
+
`otel_include_content=False` for live export or `--no-include-content` for the
|
|
406
|
+
CLI when the receiving system should only receive metadata. With content
|
|
407
|
+
disabled:
|
|
408
|
+
|
|
409
|
+
- semantic input/output is omitted;
|
|
410
|
+
- structured generic logs are omitted;
|
|
411
|
+
- scalar generic logs still export;
|
|
412
|
+
- usage and compatible model parameters still export as metadata;
|
|
413
|
+
- the workflow root keeps its title, but omits the `meta` JSON
|
|
414
|
+
(`wizardflow.message.metadata`);
|
|
415
|
+
- `otel_attributes` still export, since the application chose them.
|
|
416
|
+
|
|
417
|
+
Only export content to a receiving system appropriate for the data. Exported
|
|
418
|
+
content is deterministically serialized and bounded by
|
|
419
|
+
`otel_content_max_bytes`, measured as UTF-8 bytes. JSONL always retains the
|
|
420
|
+
original untruncated value.
|
|
421
|
+
|
|
422
|
+
Strings remain text. Other JSON-compatible input/output values are serialized
|
|
423
|
+
as text content without guessing that arbitrary object keys represent chat
|
|
424
|
+
messages. For compatible LLM and agent spans, the exporter wraps that text in
|
|
425
|
+
the official GenAI input/output message structure.
|
|
426
|
+
|
|
427
|
+
## Optional graph event
|
|
428
|
+
|
|
429
|
+
```python
|
|
430
|
+
trace = wizardflow.init(
|
|
431
|
+
nodes=[...],
|
|
432
|
+
edges=[...],
|
|
433
|
+
otel=True,
|
|
434
|
+
export_graph_to_otel=True,
|
|
435
|
+
)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
The declared graph is emitted once on each new root as a
|
|
439
|
+
`wizardflow.graph` span event. Nodes and edges are canonical JSON strings with
|
|
440
|
+
counts. Oversized graphs omit the full content and retain counts, byte size, and
|
|
441
|
+
a stable SHA-256 hash.
|
|
442
|
+
|
|
443
|
+
Graph export is off by default because topology can be sensitive or large. The
|
|
444
|
+
event uses the traces signal; it is not an OTel log record.
|
|
445
|
+
|
|
446
|
+
## Independent reinitialization
|
|
447
|
+
|
|
448
|
+
```python
|
|
449
|
+
trace.reinit(jsonl=True, otel=False) # retain the current OTel trace
|
|
450
|
+
trace.reinit(jsonl=False, otel=True) # retain the current JSONL run
|
|
451
|
+
trace.reinit() # start both anew
|
|
452
|
+
trace.reinit(otel_attributes={"deployment.environment": "staging"})
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
In workflow scope, reinitialization changes the configuration (trace name,
|
|
456
|
+
init-level `otel_attributes`) used for workflows that start afterwards.
|
|
457
|
+
Already-open workflows keep the root and context captured when they began and
|
|
458
|
+
may finish normally. In recording scope, an OTel reinitialization ends the
|
|
459
|
+
current run root and starts a new trace; already-started node spans retain the
|
|
460
|
+
trace context captured when they began.
|
|
461
|
+
|
|
462
|
+
JSONL part/run boundaries cannot reconstruct these independently chosen live
|
|
463
|
+
OTel boundaries. The offline exporter therefore creates a fresh projection
|
|
464
|
+
using its explicit `--trace-scope` while sharing the live record-to-attribute
|
|
465
|
+
mapper.
|
|
466
|
+
|
|
467
|
+
## Convention references
|
|
468
|
+
|
|
469
|
+
- [OTel GenAI spans](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/gen-ai-spans.md)
|
|
470
|
+
- [OTel GenAI agent spans](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/gen-ai-agent-spans.md)
|
|
471
|
+
- [OTel GenAI attribute registry](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/gen-ai.md)
|