Commit 184230a
authored
Add a connection pool delegate (#1515)
Motivation:
It can be useful to observe what the underlying connection pool is doing
over time. This could, for example, be instrumenting it to understand
how many streams are active at a given time or to understand when a
connection is in the processing of being brought up.
Modifications:
Add new API:
- `GRPCConnectionPoolDelegate` which users can implement and configure
on the `GRPCChannelPool` to receive notifications about the connection
pool state.
- `GRPCConnectionID`, an opaque ID to distinguish between different
connections in the pool.
Modify the connection pool:
- Per-EventLoop pools now hold on to quiescing connections and track
additional state, including whether a connection is quiescing and how
many streams are currently open on a connection. By contrast the pool
manager (which manages a number of these per-EventLoop pools) tracks
reserved streams (which are not necessarily open). The delegate tracks
_opened_ streams rather than _reserved_ streams (as reserved streams
are not allocated to a connection but to an any connection running on
an appropriate event-loop).
- Wire through the new delegate and call out to it in appropriate
places.
- Add a stream opened function to the internal H2 delegate
- Expose various pieces of state from the connection manager
Result:
Users can instrument the underlying connection pool.1 parent 85416bc commit 184230a
File tree
14 files changed
+804
-36
lines changed- Sources/GRPC
- ConnectionPool
- Tests/GRPCTests
- ConnectionPool
14 files changed
+804
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
245 | 256 | | |
246 | 257 | | |
247 | 258 | | |
| |||
582 | 593 | | |
583 | 594 | | |
584 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
585 | 621 | | |
586 | 622 | | |
587 | 623 | | |
| |||
807 | 843 | | |
808 | 844 | | |
809 | 845 | | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
810 | 851 | | |
811 | 852 | | |
812 | 853 | | |
| |||
1001 | 1042 | | |
1002 | 1043 | | |
1003 | 1044 | | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1004 | 1050 | | |
1005 | 1051 | | |
1006 | 1052 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
Lines changed: 48 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
31 | 55 | | |
32 | 56 | | |
33 | 57 | | |
| |||
36 | 60 | | |
37 | 61 | | |
38 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
39 | 68 | | |
40 | 69 | | |
41 | 70 | | |
42 | | - | |
| 71 | + | |
43 | 72 | | |
44 | 73 | | |
45 | 74 | | |
46 | 75 | | |
47 | 76 | | |
| 77 | + | |
48 | 78 | | |
49 | 79 | | |
50 | 80 | | |
51 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
52 | 88 | | |
53 | 89 | | |
54 | | - | |
| 90 | + | |
55 | 91 | | |
| 92 | + | |
56 | 93 | | |
| 94 | + | |
| 95 | + | |
57 | 96 | | |
58 | 97 | | |
59 | 98 | | |
| |||
92 | 131 | | |
93 | 132 | | |
94 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
95 | 139 | | |
96 | 140 | | |
97 | | - | |
98 | | - | |
| 141 | + | |
| 142 | + | |
99 | 143 | | |
100 | 144 | | |
101 | 145 | | |
| |||
0 commit comments