Commit 10d8e26
Fix sqlalchemy for postgres Unix sockets (#761)
* Fix sqlalchemy for postgres unix sockets
The following bit of replaced code contained a type inconsistency:
```py
attrs[SpanAttributes.NET_PEER_PORT] = int(data.get("port"))
```
`data.get` returns `Optional[str]` but `int(None)` throws a `TypeError`.
When using postgresql via unix socket `dsn` looks something like this:
```py
'user=postgres host=/tmp/socket dbname=postgres'
```
The `parse_dsn` function returns this:
```py
{'user': 'postgres', 'dbname': 'postgres', 'host': '/tmp/socket'}
```
* Update CHANGELOG
* Conditionally set net.transport for psql tcp/unix
* Use .value properties of enums
* Improve postgresql attribute detection from cursor
* Fix formatting
Co-authored-by: Matt Oberle <[email protected]>
Co-authored-by: Srikanth Chekuri <[email protected]>1 parent 2dd9bd1 commit 10d8e26
File tree
2 files changed
+26
-11
lines changed- instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy
2 files changed
+26
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
Lines changed: 23 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
170 | 182 | | |
0 commit comments