Commit 8d65e92
committed
fix(sessions): emit logger.warning with full message before truncating error_message
Truncation is a lossy operation. Without surfacing the original content,
users hitting this path on a legacy VARCHAR(255) schema had no way to
recover the full error text without attaching a debugger.
Extract the truncation logic into a pre-flight block before the
StorageEvent constructor, emit a WARNING with the event id, the length
limit, and the full original message, then pass the already-truncated
value into the constructor. This makes the information available at
WARNING level in any standard logging setup.
Also adds import logging and module-level logger following the
google_adk.<module> convention already used in the sessions package.
Test updated to assert the warning is emitted and contains the original
full message.1 parent 9966d44 commit 8d65e92
File tree
2 files changed
+24
-11
lines changed- src/google/adk/sessions/schemas
- tests/unittests/sessions
2 files changed
+24
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
294 | 310 | | |
295 | 311 | | |
296 | 312 | | |
| |||
305 | 321 | | |
306 | 322 | | |
307 | 323 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 324 | + | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
0 commit comments