Commit c5adfa7
committed
telemetry: refuse a snapshot whose latency buckets mean something else
I wrote a version field into the persisted telemetry and never read it. That is
the same failure this repository keeps producing: a fact recorded, its
consequence not drawn.
The consequence is silent corruption. A bucket stores only a COUNT, and its
meaning lives entirely in LATENCY_BUCKET_BOUNDS_MICROS, which is not written to
the file. Change those bounds and every historical count is reattributed without
a word.
I measured the damage rather than describing it. 100 probes recorded at 64 ms sit
in the bucket whose bound is 100 ms. Under a plausible refinement of the same
LENGTH, finer around 50 to 200 ms, which is exactly the region that collapsed
identical percentiles on live data hours ago, that same index means 60 ms. So the
daemon would report a 60 ms latency for samples that were all 64 ms. Nothing
errors, because a same-length change never triggers the resize.
load now refuses a snapshot whose version is not the current one and starts the
counts over, saying why. Counters are not state the product depends on, so
dropping them is the cheap and honest outcome; reporting a latency that never
happened is not.
THE REAL GUARD IS THE TEST, because the coupling is otherwise invisible. One test
pins the bucket bounds AND the version together and says, if this fails you
changed one of the two, change the other. I verified it fires: I made exactly the
refinement above without bumping the version and watched it fail with that
message.
The current version still loads, which a second test asserts, so this cannot
quietly discard every restart. The live file on this machine is version 1 and
reloads unchanged.
204 lib tests green.1 parent 72e2d67 commit c5adfa7
1 file changed
Lines changed: 110 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
222 | 232 | | |
223 | 233 | | |
224 | 234 | | |
225 | 235 | | |
226 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
227 | 246 | | |
228 | 247 | | |
229 | 248 | | |
| |||
559 | 578 | | |
560 | 579 | | |
561 | 580 | | |
| 581 | + | |
| 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 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
562 | 670 | | |
563 | 671 | | |
564 | 672 | | |
| |||
0 commit comments