Repository navigation
Commit 9b96fd2
fix(decorators): async get hits record serializer/size/hit like the sync path (LAB-3765) (#297)
* fix(decorators): async get hits record serializer/size/hit like the sync path (LAB-3765)
The async wrapper's L1-hit and L2-hit record_cache_operation calls omitted
serializer, size_bytes and hit, so FeatureOrchestrator's serializer="unknown"
default swallowed every async get hit. The sync path labels the same tiers
l1_memory / rust with the served size and hit=True. Pass the same kwargs at
both async sites; size_bytes for the L2 hit is the raw envelope the async
handler already returns, so L1 and L2 hits on one entry report the same size.
Test drives both tiers through the real decorator stack and captures at the
orchestrator, not the collector, because record_success() also forwards an
unlabelled record at these sites.
* fix(decorators): drop unreachable size guard, name the sync L2 divergence, tighten test docstrings (LAB-3765)
Panel trims: the L2 hit tuple is only built after deserialize_data succeeded on cached_data, so the else-0 branch could not run; the comment now says why this site sizes the envelope where the sync L2 site sizes str(value); the test docstring no longer calls the miss-store a backfill and bounds its claim to the L1 and uncontended L2 sites; the fixture docstring says what the override actually buys (the L1 clear the unit conftest dropped).
* docs(metrics): drop the sync-site aside from the async L2 hit comment (LAB-3765)
The sync L2 site measures the served envelope as of #298; this comment described the state it was written against and would read as a lie once both land. The remaining sentence is about this site only.
* test(decorators): assert exact served size in async hit-record test (LAB-3765)
The positive-only size_bytes assertion would pass on a wrong constant
(e.g. size_bytes=1). Pin it to the exact served envelope length: both hit
sites record the raw serialized envelope, and the L1 backfill stores the
same bytes L2 returned, so the single L2 store value is ground truth for
either tier. Addresses the CodeRabbit review nitpick.
* fix: address coderabbit review — measure async L2 str envelopes in UTF-8 bytes
The async L2 hit-record metric measured size_bytes with len(cached_data), which
counts Unicode characters when the envelope is a str, under-reporting non-ASCII
payloads. _l1_backfill_from_l2 already UTF-8-encodes str envelopes before
storing, and the L1 site's len(l1_bytes) measures bytes; measure the same
encoded envelope here so all three agree.
CodeRabbit-Resolved: wrapper.py:1716:Measure string envelopes in byt
---------
Co-authored-by: Mark S <ray@insighttimer.com>1 parent 705640b commit 9b96fd2
2 files changed
Lines changed: 100 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1629 | 1629 | | |
1630 | 1630 | | |
1631 | 1631 | | |
| 1632 | + | |
1632 | 1633 | | |
1633 | 1634 | | |
| 1635 | + | |
| 1636 | + | |
1634 | 1637 | | |
1635 | 1638 | | |
1636 | 1639 | | |
| |||
1726 | 1729 | | |
1727 | 1730 | | |
1728 | 1731 | | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1729 | 1736 | | |
1730 | 1737 | | |
1731 | 1738 | | |
| 1739 | + | |
1732 | 1740 | | |
1733 | 1741 | | |
| 1742 | + | |
| 1743 | + | |
1734 | 1744 | | |
1735 | 1745 | | |
1736 | 1746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments