Commit 70c76d2
fix(sap-demo): partial-failure tolerance in Customer360 aggregator + clearer 502 semantics
The /api/v1/customers/{id}/360 aggregator fans out 3 parallel SAP OData
calls + 2 Postgres SELECTs + 1 audit INSERT. Under Keploy record, SAP
round-trips through the eBPF MITM pick up ~2× latency, and the existing
timeouts were tight enough that a single slow-but-successful GET could
push the optional fan-outs past the aggregate deadline (or trip the
resilience4j circuit) and degrade the whole view to an empty 200 — or
worse, surface a CallNotPermittedException as a 503 from an optional
branch.
Changes:
* safely() now also catches CallNotPermittedException explicitly and
falls back to Throwable-less Exception, so nothing thrown from an
optional fan-out can 502/503 the parent request.
* Raise read-timeout 30s → 45s, connect-timeout 10s → 15s, and
aggregate-timeout 25s → 50s. All are env-overridable via
SAP_{CONNECT,READ}_TIMEOUT_SECONDS and
CUSTOMER360_AGGREGATE_TIMEOUT_SECONDS so real BTP tenants with tight
SLAs can dial them back.
* safely() log now includes the upstream HTTP status on SapApiException
so operators can see at a glance whether a fan-out was a transport
error or an upstream 5xx.
Reproduction:
1. keploy record -c "java -jar target/customer360.jar"
2. curl localhost:8080/api/v1/customers/11/360
— intermittent 502 when the roles or addresses call trips slow-call
circuit breaker, even though partner is healthy.
Root cause:
aggregate-timeout (25s) < read-timeout (30s) × potential retries (3)
for the optional calls; CallNotPermittedException escapes safely()
via the default Exception-handler path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 35d9987 commit 70c76d2
2 files changed
Lines changed: 26 additions & 4 deletions
File tree
- sap-demo-java/src/main
- java/com/tricentisdemo/sap/customer360/service
- resources
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
183 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
188 | 201 | | |
189 | 202 | | |
190 | 203 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
91 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
| |||
0 commit comments