25 Commits

Author SHA1 Message Date
53b87145b3 DB-API instrumentor populates span after sqlcomment creation, not before (#2935) 2024-11-19 09:13:31 -08:00
a940fc4a65 Add DB-API instrumentor support for MySQL driver sqlcommenting (#2897) 2024-10-30 10:46:11 -07:00
e6409568c1 Reenable pylint broad exception (#2536) 2024-05-24 11:12:53 -07:00
da75015fad fix: Ensure compability with Psycopg3 to extract libpq build version (#2500)
* fix: Ensure compability with Psycopg3 to extract libpq build version

Struggling with getting dbapi and psycopg3 working.

Think this is the error, __libpq_version does not exist on psycopg3

https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/pq_ctypes.py#L1220

* docs: Add changelog entry

* docs: Fix spelling

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-05-23 12:02:46 +03:00
b8d7448f34 Revert #1097 (#1660)
Several issues have arisen from this bugfix, reverting here until a
better solution can be found.

Fixes #1658

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-13 10:46:29 -06:00
e608df9357 Audit and test opentelemetry-instrumentation-dbapi NoOpTracerProvider (#1607) 2023-02-13 07:26:57 +00:00
78874df5c2 Fix install of Python 3.10 on GitHub Actions (#1609)
* Fix install of Python 3.10 on GitHub Actions

In PR #1604 the Python version was upgraded to Python 3.10 to fix a
local issue on M1 MacBooks.

The GitHub Action workflows now exit with the following message for the
docker-tests, spellcheck and lint checks, skipping these checks.

```
lint create: /home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/.tox/lint
SKIPPED: InterpreterNotFound: python3.10
___________________________________ summary ____________________________________
SKIPPED:  lint: InterpreterNotFound: python3.10
  congratulations :)
```

Upgrade the Python version in the GitHub Actions workflow to fix this.

* Fix YAML interpretation of Python 3.10

* Upgrade Docker tests dependencies

Upgrade the asyncpg and psycopg2 packages, they don't work on Python
3.10.

This also fixes running these tests no M1 MacBooks.

* Fix linter issues merged into main

They went unnoticed while the CI didn't fail on the lint task not
working.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-03 08:37:24 +05:30
be4ceec08c Strip leading comments from SQL queries when generating the span name. (#1434)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-11-18 14:01:07 +01:00
32d7ff4082 Flask sqlalchemy psycopg2 integration (#1224) 2022-09-08 20:18:27 +00:00
fbac424515 Add psycopg2 native tags to sqlcommenter (#1203) 2022-07-30 05:14:47 +05:30
7c75b3867b SQLCommenter semicolon bug fix (#1200) 2022-07-22 07:52:40 +05:30
6876ad857f Refactor TracedConnectionProxy (#1097)
* Refactor TracedConnectionProxy

Fixes #1077

* Remove unecessary methods
2022-06-07 18:20:59 +01:00
d54b61e687 feat(instrumentation-dbapi): add experimental sql commenter capability (#908)
* feat(instrumentation-dbapi): add experimental sql commenter capability

* Update instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>

* Fix lint

* Add CHANGELOG entry

* Fix lint

* Fix lint again

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-02-11 10:14:26 -06:00
3ec77360cb Update instrumentations to use tracer_provider for creating tracer if given, otherwise use global tracer provider (#402) 2021-04-28 08:36:37 -07:00
8d0c150b31 Sync with auto generated semantic convention constants (#428) 2021-04-19 23:37:10 -07:00
9315eb0fb2 use StatusCode from trace instead of trace.status (#366) 2021-03-09 14:33:13 -08:00
f436514554 Replaced Tracer.use_span() with opentelemetry.trace.use_span() (#364) 2021-03-08 09:33:49 -08:00
f0adb23143 Remove 'component' span attribute in instrumentations (#301) 2021-01-29 13:15:26 -08:00
8b9202be6f Updated dbapi and psycopg2 instrumentations. (#246)
Changes:

- Update dbapi instrumentation to use the SQL statement name as the span
instead of the entire SQL query.
- Renamed TracedCursor with CursorTracing. The class was not a valid
Cursor so the name was confusing.
- Updated CursorTracing's (previously TracedCursor) traced_execution
method to accept the cursor instance as the first argument. This is
required as for some dbapi implementations, we need a reference to the
cursor in order to correctly format the SQL query.
- Updated psycopg2 instrumentation to leverage dbapi's `cursor_factory`
mechanism instead of wrapping the cursor with wrapt. This results in a
simpler instrumentation without monkey patching objects at runtime and
allows psycopg2's type registration system to work. This should make it
possible to use psycopg2 instrumentation when using the JSONB feature or
with frameworks like Django.
2021-01-20 10:45:28 -08:00
a208316dca Fix tests for dbapi 2020-11-18 01:35:50 +05:30
6bf1013d2e Apply suggestions from code review
Co-authored-by: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
2020-11-08 08:52:09 -08:00
8afbd83e8c add param to control collection of db.statement.parameters 2020-11-06 09:37:28 -08:00
5cab8136f7 Change status codes from grpc status codes, remove setting status in instrumentations except on ERROR (#1282) 2020-10-28 14:28:58 -07:00
362fe9c05e Use is_recording flag in aiopg, asyncpg, dbapi, psycopg2, pymemcache, pymongo, redis, sqlalchemy instrumentations (#1212) 2020-10-08 12:25:20 -07:00
8fef469ab7 Rename db framework packages from "ext" to "instrumentation" (#966) 2020-08-03 17:48:44 -07:00