Commit 99bd851
fix(telemetry): serialize Pydantic BaseModel in _safe_json_serialize
_safe_json_serialize replaces Pydantic BaseModel instances with
'<not serializable>' because json.dumps cannot handle them natively.
Any tool that returns a Pydantic model has its traced output lost.
Replace the generic lambda default with a _default function that
calls model_dump(mode='json') for BaseModel instances before falling
back to '<not serializable>' for truly non-serializable objects.
BaseModel is already imported in tracing.py.
Fixes #4629
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 8ddddc0 commit 99bd851
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | 125 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 126 | + | |
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
| |||
0 commit comments