Commit e3af829
authored
refactor: optimize database server address tracing with WeakMap (#1027)
This change improves the database server address tracing mechanism by:
- Using WeakMap to cache server address and port information from DSN at PDO creation time
- Extracting server information directly from DSN in createPdoConnection
- Removing complex fallback logic from EventHandleListener that relied on config and read/write PDO detection
- Simplifying server address/port retrieval to direct Context lookups
The new approach is more efficient and reliable, capturing the actual connection details at the earliest point rather than inferring them later.
Co-authored-by: Deeka Wong <[email protected]>1 parent 6e659b9 commit e3af829
File tree
2 files changed
+25
-26
lines changed- src/Tracing
- Aspect
- Listener
2 files changed
+25
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
38 | | - | |
39 | | - | |
| 52 | + | |
40 | 53 | | |
41 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
42 | 58 | | |
43 | 59 | | |
44 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | 189 | | |
207 | 190 | | |
208 | 191 | | |
209 | 192 | | |
210 | 193 | | |
211 | 194 | | |
212 | 195 | | |
213 | | - | |
214 | | - | |
| 196 | + | |
| 197 | + | |
215 | 198 | | |
216 | 199 | | |
217 | 200 | | |
| |||
0 commit comments