Commit 71f4d78
authored
feat: Add client side metrics collection to readRows calls (#1571)
**Summary:**
This PR will collect client side metrics for readRows calls.
**Background:**
The following PRs have been added to support the plumbing for client-side metrics.
https://togithub.com/googleapis/nodejs-bigtable/pull/1569
https://togithub.com/googleapis/nodejs-bigtable/pull/1566
They didn't change the client behaviour at all. This PR starts using this plumbing for readRows calls.
The diagram below shows the CSM architecture with new pieces in green in the diagram:

**Changes:**
`src/client-side-metrics/operation-metrics-collector.ts:` Added optimizations and added guards to make sure that if the data from the server is of some unexpected form that it won't crash our clients.
`src/index.ts:` Add code to generate a uuid for each client and store the GCP metrics handler on the client. Also add piping to pass status events along and add a setting that lets users turn off client side metrics.
`src/tabular-api-surface.ts`: Use the metrics collector with the gcp metrics handler to collect client side metrics in readRows calls
`system-test/client-side-metrics-setup-table.ts:` A test utility function for setting up an instance with a few tables
`system-test/client-side-metrics.ts:` A file with some tests for capturing various scenarios where a user might be collecting client side metrics that ensures the right metrics are exported without error even when multiple tables, instances or clients are involved.
`system-test/read-rows.ts:` This test has a mock that is client side metrics incompatible so don't use client side metrics in this test.
**Next Steps:**
- Add plumbing for application blocking latencies
- Collect client side metrics for other grpc endpoints1 parent 4d1652d commit 71f4d78
File tree
27 files changed
+2054
-819
lines changed- src
- client-side-metrics
- utils
- system-test
- test-common
- test
- metrics-collector
27 files changed
+2054
-819
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
122 | | - | |
| 121 | + | |
123 | 122 | | |
124 | 123 | | |
125 | 124 | | |
| |||
184 | 183 | | |
185 | 184 | | |
186 | 185 | | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
222 | 218 | | |
223 | 219 | | |
224 | 220 | | |
| |||
297 | 293 | | |
298 | 294 | | |
299 | 295 | | |
300 | | - | |
| 296 | + | |
301 | 297 | | |
302 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
303 | 308 | | |
304 | 309 | | |
305 | | - | |
| 310 | + | |
306 | 311 | | |
307 | 312 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
332 | 316 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | 317 | | |
337 | 318 | | |
338 | 319 | | |
339 | 320 | | |
340 | | - | |
341 | | - | |
342 | | - | |
| 321 | + | |
| 322 | + | |
343 | 323 | | |
344 | 324 | | |
345 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 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 | + | |
30 | 57 | | |
31 | 58 | | |
32 | 59 | | |
| |||
47 | 74 | | |
48 | 75 | | |
49 | 76 | | |
50 | | - | |
51 | 77 | | |
52 | 78 | | |
53 | | - | |
| 79 | + | |
54 | 80 | | |
55 | 81 | | |
56 | 82 | | |
| |||
80 | 106 | | |
81 | 107 | | |
82 | 108 | | |
83 | | - | |
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
| |||
183 | 208 | | |
184 | 209 | | |
185 | 210 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 211 | + | |
| 212 | + | |
191 | 213 | | |
192 | 214 | | |
193 | 215 | | |
| |||
196 | 218 | | |
197 | 219 | | |
198 | 220 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | 221 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
0 commit comments