Commit 65a2679
Split internalServerErrorCount by wire-visibility (#3297)
* Split internalServerErrorCount by wire-visibility
nettyMetrics.internalServerErrorCount previously incremented
unconditionally whenever a generic (non-RestServiceException,
non-client-termination) exception was handled in
NettyResponseChannel#getErrorResponse, even when the constructed 500
response could never actually be written to the client because
response metadata (e.g. a 200) had already been committed for a
streamed response.
This conflated two different failure modes under one counter/alert:
- a 500 that actually reached the client on the wire
- a post-commit failure where the client instead sees a force-closed
connection after a partially delivered 200
Add internalServerErrorAfterResponseCommittedCount to track the
second case separately, so internalServerErrorCount now reflects only
errors that were actually written to the wire. The sum of the two
new counters equals what internalServerErrorCount counted before this
change.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Revert metric split; track offline-service 500s after response commit instead
Replace the previous internalServerErrorCount /
internalServerErrorAfterResponseCommittedCount split with the original,
simpler behavior: internalServerErrorCount is incremented
unconditionally for generic internal errors again, exactly as before
this PR, so no existing alerting/dashboards keyed on it need to change.
A 500 that could not be delivered to the client because response
metadata (e.g. a 200) was already committed for a streamed GET is
still a case worth tracking - but only distinctly for known offline
(e.g. composite router secondary/parity-check) callers, since those
already-committed-response drops for that traffic are expected and
otherwise indistinguishable from a genuine client-facing incident.
Add a new netty.server.offline.service.ids config listing the
x-ambry-service-id values (as configured for those callers, e.g. in
the composite router config) that identify offline traffic. When a
request from one of those service IDs hits the already-committed-500
case, increment a new, additive NettyMetrics#offlineInternalServerErrorOnlyCount
counter (OfflineInternalServerErrorOnlyCount.Count.rrd) instead of
introducing a second alerting metric.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Fix TOCTOU race in offline-metric detection
Read responseMetadataWriteInitiated after the CAS attempt in
maybeSendErrorResponse(), not before. A concurrent writer (e.g. a
router content-write callback) can commit response metadata on
another thread between the earlier snapshot and our own CAS attempt,
which could cause the offline metric to be silently skipped even
though a response was already committed to the client.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Add offline-only 503 (ServiceUnavailable) tracking, mirroring the 500 case
Adds offlineServiceUnavailableOnlyCount, incremented under the same
conditions as offlineInternalServerErrorOnlyCount but for a genuine
ServiceUnavailable (503) that never reached the wire because response
metadata was already committed, for a request from a configured
offline service ID. Host-level-throttled drops are excluded, matching
how the existing serviceUnavailableErrorCount already excludes them
from polluting SLO dashboards.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Add offlineHostLevelThrottledOnlyCount for offline host-level-throttled drops
Mirrors offlineInternalServerErrorOnlyCount/offlineServiceUnavailableOnlyCount:
tracks host-level-throttled 503 drops that never reached the wire because
response metadata was already committed, for a request from a configured
offline service ID. Kept as its own counter, matching how hostLevelThrottledCount
is already tracked separately from serviceUnavailableErrorCount.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Trim and drop empty entries when parsing netty.server.offline.service.ids
Previously an unconfigured (or trailing-comma) value produced a set
containing a single empty string instead of a truly empty set, so the
isEmpty() fast-path in isOfflineServiceRequest() was never hit by
default. A stray space after a comma also produced an id that could
never match via exact Set.contains(...). Trim each entry and drop
empties so both cases are handled correctly.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Sophie Guo <sopguo@sopguo-mn2.linkedin.biz>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent cbb372d commit 65a2679
5 files changed
Lines changed: 344 additions & 0 deletions
File tree
- ambry-api/src
- main/java/com/github/ambry/config
- test/java/com/github/ambry/config
- ambry-rest/src
- main/java/com/github/ambry/rest
- test/java/com/github/ambry/rest
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
| |||
190 | 204 | | |
191 | 205 | | |
192 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
193 | 215 | | |
194 | 216 | | |
195 | 217 | | |
| |||
Lines changed: 44 additions & 0 deletions
| 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 | + | |
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
134 | 142 | | |
135 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
136 | 148 | | |
137 | 149 | | |
138 | 150 | | |
| |||
325 | 337 | | |
326 | 338 | | |
327 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
328 | 344 | | |
329 | 345 | | |
330 | 346 | | |
331 | 347 | | |
| 348 | + | |
| 349 | + | |
332 | 350 | | |
333 | 351 | | |
334 | 352 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
593 | 597 | | |
594 | 598 | | |
595 | 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 | + | |
596 | 625 | | |
597 | 626 | | |
598 | 627 | | |
599 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
600 | 642 | | |
601 | 643 | | |
602 | 644 | | |
| |||
607 | 649 | | |
608 | 650 | | |
609 | 651 | | |
| 652 | + | |
610 | 653 | | |
611 | 654 | | |
612 | 655 | | |
| |||
618 | 661 | | |
619 | 662 | | |
620 | 663 | | |
| 664 | + | |
621 | 665 | | |
622 | 666 | | |
623 | 667 | | |
| |||
0 commit comments