* 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 <mattoberle@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
* respect provided tracer provider when instrumenting sqlalchemy
This change updates the SQLALchemyInstrumentor to respect the tracer
provider that is passed in through the kwargs when patching the
`create_engine` functionality provided by SQLAlchemy. Previously, it
would default to the global tracer provider.
* feedback: pass in tracer_provider directly rather than kwargs
* feedback: update changelog
* build: lint
The `sqlalchemy` instrumentation uses the `packaging` library to parse
the `sqlalchemy` SemVer.
`packaging` is not part of the standard library and should be included
in the `setup.cfg` file to avoid:
```
ModuleNotFoundError: No module named 'packaging'
```
Co-authored-by: Matt Oberle <mattoberle@users.noreply.github.com>
Co-authored-by: Owais Lone <owais@users.noreply.github.com>
- We now automatically generate bootstrap_gen.py file from the list of instrumentations present in the source tree.
- Bootstrap command now uses consumes this auto-generated list instead of keeping it's own local copy.
- We no longer uninstall packages before installing them as instrumentation package no longer specify libraries as dependencies so the edge cases are no longer there.
- We no longer try to install an incompatible version or force upgrade/downgrade an installed version. This used to leave systems in broken states which should happen no more.
All instrumentations packages have almost exactly same setup.py files.
This commit adds a python script that generates it from a source
template. This dramatically reduces the time and effort required to
update all instrumentation setup.py files, and also reduces chances of
making manual mistakes.
Current instrumentation uses the entire SQL query as the operation name
which makes traces very hard to read and understand in addition to
introducing high-cardinality issues. This commit fixes the problem by
using only the SQL operation name and the DB name instead of the entire
query.