Commit 4606c73
feat(aso-overlay): CloudWatch EMF instrumentation for READ path (SITES-48140) (#2822)
## Summary
Instruments `GET /config/:service/redirects.txt` and the ASO overlay
auth handler with CloudWatch Embedded Metric Format (EMF) via stdout
envelopes under the new `Mysticat/AsoOverlay` namespace. No IAM change;
no PutMetricData calls; reuses the existing `metrics-emf.js` pattern
already proven on `Mysticat/GitHubService` (webhooks) and
`Mysticat/Brands`.
Closes the observability gap Cornel called out: *"aso needs to have its
own monitoring/observability in place — each service needs to have its
own dashboards, dispatcher will not monitor for broken API keys"*.
Tracked in [SITES-48140](https://jira.corp.adobe.com/browse/SITES-48140)
(linked to
[SITES-44966](https://jira.corp.adobe.com/browse/SITES-44966)).
Paired PR on `spacecat-infrastructure`:
adobe/spacecat-infrastructure#675 — Grafana + Splunk dashboards
visualizing these metrics.
## Metrics emitted
Frozen catalog in `src/support/aso-overlay-metrics.js`:
| Metric | Unit | Dimensions | Purpose |
|--------|------|-----------|---------|
| `AsoOverlayRequestTotal` | Count | Environment, Outcome, Tier | Volume
+ outcome split |
| `AsoOverlayRequestDurationMs` | Milliseconds | Environment, Outcome |
End-to-end latency |
| `AsoOverlayEtagPresent` | Count | Environment | ETag emission health |
| `AsoOverlayConditionalGet304` | Count | Environment | Cache-hit rate |
| `AsoOverlayIfNoneMatchInvalid` | Count | Environment,
Reason=`unquoted` | RFC 7232 sidecar bug signal |
| `AsoOverlayS3ReadDurationMs` | Milliseconds | Environment, Outcome |
S3 backend health |
| `AsoOverlayAuthKeyUsed` | Count | Environment,
Slot=`current\|previous` | **Rotation-in-flight signal** |
| `AsoOverlayAuthFailed` | Count | Environment, Reason |
Defense-in-depth (most fail at Fastly edge) |
## Design notes
**Cardinality:** No per-tenant dimensions (10k+ services would blow the
budget). Tenant-level views come from Fastly access logs in Splunk.
**Rotation observability (crown jewel):**
`AsoOverlayAuthKeyUsed{Slot=previous}` non-zero signals rotation
in-flight; sustained non-zero across > 24h signals the sidecar fleet
hasn't picked up the new key.
**INM validity:** `AsoOverlayIfNoneMatchInvalid{Reason=unquoted}` spikes
indicate specific sidecar rollouts parsing ETags wrong (RFC 7232 §2.3
requires quoted opaque-tag). Empty/whitespace-only INM is normalized to
`null` by `getHeader()` so is not tracked separately.
**Auth handler scope:** `AsoOverlayKeyHandler` runs on every request.
Metrics are emitted **only** for the overlay route to avoid flooding the
namespace.
**Fault tolerance:** All metric emission is wrapped in try/catch inside
`emitMetric()` — a stdout write failure never breaks the request path.
## Complementary follow-ups (tracked on SITES-48140)
- **Fastly VCL enhancement** — emit key-slot-matched + 401-sub-reason as
log fields for the edge-decided requests that never reach origin. Needs
platform team owner (Alina/Cornel) — ASO team lacks Fastly rights.
- **`mystique` #3381** — `aso_overlay_fastly_purge_*` Prometheus metrics
on WRITE path.
- **Grafana alert rules** — rotation-slot=previous > 24h, 401 spike, 304
rate collapse, S3 AccessDenied spike.
## Test plan
- [x] 14 controller-level metric tests + 7 auth-handler metric tests
(all new)
- [x] 100% coverage on new files
- [x] Full suite: 14968 passing, 0 failing
- [x] ESLint clean; type-check passes
- [x] Existing 53-test redirects suite still green (instrumentation is
additive)
- [ ] Post-deploy on dev: verify EMF envelopes land in CloudWatch under
`Mysticat/AsoOverlay` with correct dimensions
- [ ] Wire Grafana dashboard (paired PR) against dev metrics before
promoting to stage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Abhishek Garg <abhigarg+adobe@adobe.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5aa68e2 commit 4606c73
5 files changed
Lines changed: 718 additions & 10 deletions
File tree
- src
- controllers
- support
- test
- controllers
- support
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
137 | 170 | | |
138 | 171 | | |
139 | 172 | | |
| 173 | + | |
140 | 174 | | |
141 | 175 | | |
142 | 176 | | |
143 | 177 | | |
| 178 | + | |
144 | 179 | | |
145 | 180 | | |
146 | 181 | | |
| |||
155 | 190 | | |
156 | 191 | | |
157 | 192 | | |
| 193 | + | |
158 | 194 | | |
159 | 195 | | |
160 | 196 | | |
| |||
166 | 202 | | |
167 | 203 | | |
168 | 204 | | |
| 205 | + | |
169 | 206 | | |
170 | 207 | | |
171 | 208 | | |
172 | 209 | | |
173 | 210 | | |
174 | 211 | | |
| 212 | + | |
175 | 213 | | |
176 | 214 | | |
177 | 215 | | |
178 | 216 | | |
179 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
180 | 231 | | |
181 | 232 | | |
182 | 233 | | |
| 234 | + | |
183 | 235 | | |
184 | 236 | | |
185 | 237 | | |
| |||
191 | 243 | | |
192 | 244 | | |
193 | 245 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
200 | 266 | | |
201 | 267 | | |
202 | 268 | | |
| |||
215 | 281 | | |
216 | 282 | | |
217 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
218 | 288 | | |
219 | 289 | | |
220 | 290 | | |
| |||
231 | 301 | | |
232 | 302 | | |
233 | 303 | | |
| 304 | + | |
| 305 | + | |
234 | 306 | | |
235 | 307 | | |
236 | 308 | | |
| |||
245 | 317 | | |
246 | 318 | | |
247 | 319 | | |
| 320 | + | |
| 321 | + | |
248 | 322 | | |
249 | 323 | | |
250 | 324 | | |
| 325 | + | |
| 326 | + | |
251 | 327 | | |
252 | 328 | | |
253 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
| 71 | + | |
65 | 72 | | |
66 | 73 | | |
67 | 74 | | |
68 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
71 | | - | |
| 84 | + | |
72 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
73 | 90 | | |
74 | 91 | | |
75 | 92 | | |
76 | 93 | | |
77 | 94 | | |
78 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
79 | 100 | | |
80 | 101 | | |
81 | 102 | | |
82 | 103 | | |
83 | | - | |
84 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
85 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
86 | 123 | | |
87 | 124 | | |
88 | 125 | | |
| |||
| 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 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
0 commit comments