Commit 052bbc5
committed
feat: add performance metrics logging to SR worker
Restore structured performance metrics logging that was present in
the original echo worker, enabling E2E latency tracking and component
breakdown analysis in CloudWatch.
Implementation matches the original echo/index.ts pattern from PR #18:
- SR worker collects timing metrics and logs 'Performance metrics'
- Handler returns syncResponseMs and asyncResponseMs
- Worker calculates E2E, queue wait, and total duration
- Metrics logged for both success and failure cases
Performance metrics fields:
- totalE2eMs: API Gateway → final response (end-to-end)
- workerDurationMs: Lambda execution time
- queueWaitMs: Time message spent in SQS (calculated)
- syncResponseMs: Sync Slack response time (from handler)
- asyncResponseMs: Async Slack response time (from handler)
- component: 'sr-worker' for CloudWatch filtering
- correlationId, command, success, errorType, errorMessage
Changes:
- Removed artificial 2-second sleep delay from echo handler
- Echo handler now returns HandlerResult with timing metrics
- SR worker logs structured metrics via logWorkerMetrics()
This restores server-side metrics collection after the quadrant-based
refactor, enabling performance test analysis scripts to work correctly.1 parent 22273a9 commit 052bbc5
2 files changed
Lines changed: 95 additions & 20 deletions
Lines changed: 28 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
11 | 23 | | |
12 | | - | |
13 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
14 | 30 | | |
15 | 31 | | |
16 | 32 | | |
| |||
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
47 | | - | |
| 63 | + | |
48 | 64 | | |
49 | 65 | | |
50 | | - | |
| 66 | + | |
51 | 67 | | |
52 | 68 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 69 | | |
57 | 70 | | |
58 | 71 | | |
| |||
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
80 | | - | |
| 93 | + | |
81 | 94 | | |
82 | 95 | | |
83 | | - | |
| 96 | + | |
84 | 97 | | |
85 | 98 | | |
86 | 99 | | |
87 | 100 | | |
88 | | - | |
| 101 | + | |
89 | 102 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
93 | 108 | | |
94 | 109 | | |
95 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 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 | + | |
12 | 41 | | |
13 | 42 | | |
14 | 43 | | |
15 | 44 | | |
16 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
17 | 49 | | |
18 | 50 | | |
19 | 51 | | |
| |||
35 | 67 | | |
36 | 68 | | |
37 | 69 | | |
| 70 | + | |
38 | 71 | | |
39 | 72 | | |
40 | 73 | | |
41 | | - | |
| 74 | + | |
42 | 75 | | |
43 | 76 | | |
44 | 77 | | |
| |||
70 | 103 | | |
71 | 104 | | |
72 | 105 | | |
73 | | - | |
74 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
75 | 125 | | |
76 | | - | |
77 | 126 | | |
78 | 127 | | |
79 | | - | |
| 128 | + | |
| 129 | + | |
80 | 130 | | |
81 | 131 | | |
82 | 132 | | |
83 | 133 | | |
| 134 | + | |
84 | 135 | | |
85 | | - | |
| 136 | + | |
86 | 137 | | |
87 | 138 | | |
88 | 139 | | |
89 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
90 | 150 | | |
91 | 151 | | |
92 | 152 | | |
| |||
0 commit comments