Repository navigation
Commit 4ca5a0b
committed
fix(engine) #5636: capture the departing counters before the removal, not after
Round 3 review on #5640. Point 1 was a real bug, not polish.
unregisterDatabase removed the database from the set FIRST and folded its counters SECOND. A throw from
accumulateMonotonic in between dropped the database out of `databases` with its contribution never folded into
retainedStats, so the next scrape came back lower than the last - which, now that these series are typed as
Prometheus counters, is read as a reset and fabricates exactly the rate() spike the baseline exists to prevent.
The old comment called that "the pre-#5636 behaviour", which understated it: before, a close decreased a GAUGE
and meant nothing. Capture now happens into a temp before the removal, so the window is closed rather than
argued away. The one case that still steps back - the capture itself failing, where the database has to leave
the registry regardless or every later toJSON() throws on the same dead source - is logged at WARNING instead of
FINE, because it is the only remaining path that can produce the artifact and an operator staring at an
unexplained spike needs that line.
Point 2: statOf defaulting a missing key to 0 is right for the scrape path but means a typo in DB_STAT_KEYS
degrades to a silently wrong total, and nothing else would catch it - every other assertion reads through the
same defaulting. Now checked against a real getStats() map, reading Profiler's OWN key list reflectively; a
second copy of the list in the test would have passed happily while production carried the typo. Verified by
planting one.
Point 3: metersKeepReportingAfterTheBinderIsCollected did not pin what it claimed. System.gc() is a hint, and
since the meters read through the static cache the values came back either way - so it would have kept passing
if someone regressed CACHE to an instance field, the exact bug it existed to catch. Replaced with a structural
assertion that no field of the binder is an instance field, which does fail on that regression (verified by
making CACHE non-static).
Points 4 and 5 were confirmations of deliberate choices; no change.1 parent 9ce18eb commit 4ca5a0b
3 files changed
Lines changed: 76 additions & 11 deletions
File tree
- engine/src
- main/java/com/arcadedb
- test/java/com/arcadedb
- server/src/test/java/com/arcadedb/server/monitor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
109 | 116 | | |
110 | | - | |
111 | 117 | | |
112 | | - | |
113 | | - | |
| 118 | + | |
114 | 119 | | |
115 | | - | |
116 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
117 | 125 | | |
118 | | - | |
| 126 | + | |
| 127 | + | |
119 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
120 | 135 | | |
121 | 136 | | |
122 | 137 | | |
| |||
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
100 | 135 | | |
101 | 136 | | |
102 | | - | |
| 137 | + | |
103 | 138 | | |
104 | 139 | | |
105 | 140 | | |
| |||
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
111 | | - | |
112 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
116 | 131 | | |
117 | 132 | | |
118 | 133 | | |
| |||
0 commit comments