62 Commits

Author SHA1 Message Date
70187ff3a3 Pymongo capture collection name (#1555) 2023-01-11 12:47:54 +00:00
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
5f85a5bd74 Remove db.name attribute from Redis instrumentation (#1427) 2022-11-10 19:21:44 +00:00
40e4e2e598 Fix dbapi connection instrument wrapper has no _sock member (#1424)
Fixes https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1353

Also:

Fix the check for the connection already being instrumented in instrument_connection()
Add tests for commit() and rollback()
Add a couple missing docstring items.
Add basepython to docker-tests to fix running the tests on macOS.
2022-11-07 16:00:28 +00:00
f349e380a2 asyncpg: Use only the first word from query as a span name (#1324) 2022-09-30 16:24:31 +05:30
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
d75194aed7 Sync with sdk setup from setUpClass to setUp (#1193) 2022-07-19 02:02:13 +05:30
2ce69a668f Add span for connection phase (#1134) 2022-07-17 21:09:15 +05:30
8823655b1c Instrument RedisCluster clients (#1177)
* Instrument RedisCluster clients

* reformat files

* update changelogs

* refactor _traced_execute_pipeline

* handle AttributeError

* handle IndexError

* refactor _traced_execute_pipeline

* move hasattr check to _set_connection_attributes function

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-07-07 15:00:09 +02:00
fa56c6c09f Instrument redis.asyncio clients (#1076) 2022-05-05 06:39:29 +05:30
e861b93362 Extending SQLCommenter support of dbapi into psycopg2 (#940)
* Added configuration for sqlcommenter

* Fixed linting errors

* Updated CHANGELOG.md

* Unit test case for sqlcommenter in psycopg2

* Merge conflict resolved

* Update CHANGELOG.md

* psycopg2 sqlcommenter integration test

* linting changes

* linting changes

* linting changes

* linting changes

* linting changes

* version compatability issue fix

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2022-03-17 19:19:30 -06:00
3137c1fa41 Upgrade black (#802) 2021-11-10 20:57:01 +00:00
07c52aad38 Refactor code using pyupgrade for Python 3.6 (#770)
* Refactor code using pyupgrade for Python 3.6

This diff is the result of applying the following command to the
project:

```shell
find . -type f -name "*.py" -exec pyupgrade --py36-plus '{}' +
```

* Simplify yield from
2021-10-24 07:04:06 +05:30
b41a91713e Fix mssql docker tests v4 (#727)
* Remove unneded CI steps

These were not really needed and got in by mistake.

* Fix broken mssql integration tests

We were giving mssql server 10 seconds to start before creating the test
database. It now takes Github CI more than 10 seconds to start the mssql
server. Instead of increasing the leeway with guesses, this commit moves
the creation of test database from docker compose to the python test suite.
This allows the docker image to come up first and then create the DB
inside the test suite with proper retry mechanism that is already in
place.
2021-10-12 17:19:13 +02:00
cc2e7d276b Fix mssql docker tests v2 (#723)
* Pin ubuntu to 20.04 in CI

* Fix mssql docker tests
2021-10-12 01:43:32 +05:30
c4639ee3f5 Fix flaky celery docker test (#652)
The test was actually generating 2 spans but on very fast systems we
only saw one as the test ran faster than the message would travel
through the broker, trigger a task and generate 2nd span.

Switched from .delay() to .apply() so only one span is generated which
is enough for the test in question.
2021-09-02 10:14:38 +02:00
b6e49ba66d Remove unused imports (#646)
* Remove unused imports

Fixes #645

* Fix lint

* Import trace_tween_factory

* Fix lint

* Fix lint

* Fix pylint

* Try without using the symbol

* Fix isort

* Revert "Fix isort"

This reverts commit 4dbd91450b4ee099fd09ab1ca0fb8ae9c10bdcfa.

* Revert "Try without using the symbol"

This reverts commit d94f95564671a3155edf44bf71bf58f22ca309f0.
2021-09-01 19:38:02 +02:00
c279ee59a8 Rerun a flaky test (#639)
* Rerun a flaky test
2021-08-31 03:47:58 +05:30
c6976fc51f Potential fix for flaky celery test (#629)
It seems the same in memory span exporter was being reused by multiple
tests. This change _should_ create a new instance of memeory exporter
per test/function.

Fixes #2067
2021-08-26 03:30:26 +05:30
c8b6de6c1c Add support for SQLAlchemy 1.4 (#568) 2021-08-04 15:00:10 -07:00
b2dd4b8205 Fix pyodbc cursor error in SQLA instrumentation (#469) 2021-06-07 09:11:37 -07:00
a3ecbc1f41 Add SQLAlchemy multithreading test (#468) 2021-06-03 08:33:06 -07:00
8d0c150b31 Sync with auto generated semantic convention constants (#428) 2021-04-19 23:37:10 -07:00
08682f6f1d redis: fix default port KeyError, wrong attr name (#265)
* redis: fix default port KeyError, wrong attr name
* fix docker tests and another ip/port issue in asyncpg

Co-authored-by: Alex Boten <aboten@lightstep.com>
2021-04-14 08:45:36 -07:00
634c2ac0ae Update redis instrumentation to follow semantic conventions (#403) 2021-04-05 11:19:16 -07:00
12da395364 fix instrumentation of connection when pool.acquire was called multiple times (#381) 2021-04-02 16:45:12 -07:00
9315eb0fb2 use StatusCode from trace instead of trace.status (#366) 2021-03-09 14:33:13 -08:00
6720930cdb rename simple/batch span processors (#352) 2021-03-01 13:40:25 -08:00
c265e2f035 Remove metrics from main branch (#312) 2021-02-05 16:41:03 -08:00
b53b9a012f Fix failing aiopg tests (#317) 2021-02-04 17:39:24 -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
8c8f2785bd SQLAlchemy: Use SQL operation and DB name as the Span name (#254)
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.
2021-01-20 08:41:19 -08:00
6514f37177 Prometheus Remote Write Exporter (5/6) (#216) 2020-12-09 10:46:31 -08:00
49f8c52e17 Merge branch 'dbindex-redis' of https://github.com/lonewolf3739/opentelemetry-python-contrib into dbindex-redis 2020-11-24 20:05:44 +05:30
659007cd20 Add db for both name and database_index 2020-11-24 20:05:14 +05:30
13976b5275 Merge branch 'master' into dbindex-redis 2020-11-24 09:32:30 -05:00
8541371c2e Update get command value 2020-11-24 13:10:12 +05:30
bfc55f5634 Lint fix 2020-11-24 10:47:51 +05:30
c3f94c39c9 Add test for database_index 2020-11-24 10:43:22 +05:30
c1452b71ce Merge branch 'master' into asyncpg-semantic-conv 2020-11-23 15:39:07 -05:00
b7f8a5bee3 Merge branch 'master' into sqlalchemy-semantic-conv 2020-11-23 13:48:34 -05:00
184f786d9f Merge branch 'master' into dbapi-semantic-conv 2020-11-23 10:50:44 -05:00
868dd770a5 Merge branch 'master' into sqlalchemy-semantic-conv 2020-11-23 10:45:32 -05:00
963f65cb33 Fix lint 2020-11-22 01:27:52 +05:30
d51636e2c0 Update pymongo instrumentation to follow semantic conventions 2020-11-22 01:21:36 +05:30
69b6c378c8 Lint fix 2020-11-21 22:43:53 +05:30
3786d6d0fa Fix tests 2020-11-21 22:22:57 +05:30
f601bb2563 Fix env vars 2020-11-20 00:54:54 +05:30
2228573bf3 Fix docker tests 2020-11-18 01:41:59 +05:30