Commit 02093c7
[core][metric] improve histogram metrics midpoint calculation (ray-project#57948)
There’s a potential risk in the current midpoint calculation. It can be
wrong when values are negative.
Line 167: lower_bound + buckets[0] / 2.0
Line 171: (buckets[i] + buckets[i - 1]) / 2.0
I improved the formula and added a test to make sure it works.
Signed-off-by: justwph <2732352+wph95@users.noreply.github.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>1 parent 9595df0 commit 02093c7
File tree
2 files changed
+11
-1
lines changed- python/ray
- _private/telemetry
- tests
2 files changed
+11
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
| |||
0 commit comments