Repository navigation
Commit 94e1e85
committed
fix: inject tenantId into InvokeStore for custom JSON logs
runWithInvokeContext only stored REQUEST_ID and X_RAY_TRACE_ID in the
InvokeStore, never TENANT_ID. The JSON loggers read tenantId via
invokeStore.getTenantId() (PROTECTED_KEYS.TENANT_ID), so it was always
undefined, fell back to "", and formatJsonMessage's `if (tenantId)`
guard dropped the field. The header was parsed correctly onto
context.tenantId (hence available in code and platform events), but that
value never reached the store the loggers consult.
Thread context.tenantId through runWithInvokeContext and set
PROTECTED_KEYS.TENANT_ID for both the single- and multi-concurrent call
sites so tenantId appears in custom JSON log entries, matching the
documented behavior and the Python runtime.
Add regression tests covering both call sites. tenantId is pinned to the
sandbox, so it stays constant across every invocation in the execution
environment's lifecycle (unlike requestId/traceId).
Ref: V2290595765
cr: https://code.amazon.com/reviews/CR-2900169551 parent 1114b37 commit 94e1e85
2 files changed
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
356 | 380 | | |
357 | 381 | | |
358 | 382 | | |
| |||
556 | 580 | | |
557 | 581 | | |
558 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
559 | 622 | | |
560 | 623 | | |
561 | 624 | | |
| |||
897 | 960 | | |
898 | 961 | | |
899 | 962 | | |
| 963 | + | |
900 | 964 | | |
901 | 965 | | |
902 | 966 | | |
| |||
915 | 979 | | |
916 | 980 | | |
917 | 981 | | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
918 | 990 | | |
919 | 991 | | |
920 | 992 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
0 commit comments