1755 Commits

Author SHA1 Message Date
88783f9632 Allow Kafka producer headers to be dict or list (#1655)
* Allow Kafka producer headers to be dict or list

* modify kafka context getter helper methods to work on dict and list

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-03-10 12:59:05 +00:00
419975138b Fix httpx resource warnings (#1695) 2023-03-08 11:54:32 +00:00
e5d9ac5755 fix fastapi instrumentation tests for version 0.91 (#1710) 2023-03-07 20:29:24 +05:30
135280e539 Change instruments version for fastapi and starlette (#1708) 2023-03-06 10:34:22 -08:00
4a859e34d6 Remove custom arguments in object.__new__ of BaseInstrumentor (#1439)
* Add a test case to reproduce the issue

* Fix the class initialization when parameters are provided

* Update CHANGELOG.md

* Fix linting issues

* Additional test case which inits SystemMetricsInstrumentor twice

* Updated linting following update to black style

* Moved changelog entry to unreleased section

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2023-02-28 11:19:30 -06:00
b701980ab8 rel (#1700) 2023-02-27 12:34:14 -08:00
c5a2db5cfb Add entry for sqlalchemy component owner (#1696) 2023-02-27 23:52:16 +05:30
d6a024302e Fix AWS Lambda documentation (#1693)
Fix `ImportError: cannot import name 'AwsBotocoreInstrumentor' from 'opentelemetry.instrumentation.botocore'`

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-27 14:11:32 +00:00
7ffbfc302e Add metrics instrumentation sqlalchemy (#1645) 2023-02-26 20:21:42 +05:30
0417141a70 Add support for enabling Redis sanitization from environment variable (#1690)
* Add support for enabling Redis sanitization from environment variable

* add sanitization environment variable docs

* strip environment variable

* update changelog

* lint

* lint

* lint - hopefully the last time

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-25 01:27:31 +00:00
85ae95c88f Fix exception in Urllib3 when dealing with filelike body. (#1399) 2023-02-25 00:41:06 +00:00
a7bd56354b Change metrics test to work with base_test.py (#1688) 2023-02-25 03:35:45 +05:30
a50caf26bc Fix exporter example docker-compose path (#1691) 2023-02-24 03:35:57 +00:00
74a8b902f1 Fix issue with Flask instrumentation when a request spawn children threads and copies the request context (#1654) 2023-02-22 21:37:59 +00:00
3bcc043e9d Add connection attributes to sqlalchemy connect span (#1608)
* Add connection attributes to sqlalchemy connect span

* Fix formatting

* Move changelog entry to unreleased section

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-02-20 17:17:18 +00:00
d5cbd67e88 Add boto3sqs to docs (#1666) 2023-02-20 21:51:13 +05:30
aa6397ad59 Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracer… (#1616)
* Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracerProvider

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-18 02:07:07 +00:00
52d01f9e6f Copy change log updates from release/v1.16.x-0.37bx (#1683) 2023-02-18 06:40:50 +05:30
482804451a Update version to 1.17.0.dev/0.38b0.dev (#1677)
* Update version to 1.17.0.dev/0.38b0.dev

* Update SHA

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-17 11:42:54 -06:00
79d00ee7d3 Fix CI Failure (#1680)
* Fix CI Failure

* Actually fix

* Should be fixed now?

* Update tox.ini

* Disable test

* pypy3.7
2023-02-17 10:32:10 -06:00
ffbbb4d8e3 Add better debugging if hatch subprocess fails (#1672) 2023-02-15 21:46:56 +05:30
1e89854832 Add confluent kafka docs (#1668)
* add elasticsearch to docs

* add confluent kafka to docs

* tox generate fix

* tox docs fix

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-15 12:17:28 +00:00
5e4766ed66 Support aio_pika 9 (#1670) 2023-02-15 17:11:07 +05:30
b513d1f910 Audit and test opentelemetry-instrumentation-wsgi NoOpTracerProvider (#1610) 2023-02-13 22:55:13 +00:00
1c50e47b56 bot (#1667) 2023-02-13 15:46:40 -06:00
3f8fdf2620 Add commit method for ConfluentKafkaInstrumentor's ProxiedConsumer (#1656) 2023-02-13 19:02:27 +00: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
7aa4aec3a6 Audit and test opentelemetry-instrumentation-django NoOpTracerProvider (#1611) 2023-02-13 15:01:48 +00:00
0a4b3b4a0c Audit and test opentelemetry-instrumentation-aiohttp-client NoOpTrace… (#1612) 2023-02-13 11:00:24 +00:00
260df4dc6d Audit and test opentelemetry-instrumentation-flask NoOpTracerProvider (#1614) 2023-02-13 09:49:17 +00:00
e608df9357 Audit and test opentelemetry-instrumentation-dbapi NoOpTracerProvider (#1607) 2023-02-13 07:26:57 +00:00
bb41b4600a Fix fastapi version (#1664) 2023-02-13 12:17:38 +05:30
3bcc9fb517 add a test for pymemcache using NoOpTracerProvider (#1650)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-11 15:11:22 +05:30
df32e8ca7f add elasticsearch db.statement sanitization (#1598) 2023-02-10 06:20:42 +05:30
dbf
7af87e1bec [TortoiseORM instrumentation] Fix AttributeError: type object 'Config' has no attribute 'title' (#1575)
* Use pydantic model name as default `title` value

* Update `CHANGELOG.md`

* Format with black

* Lint with `black`
2023-02-06 12:20:20 +00:00
66ceef5fe1 Support aio_pika 8.x (#1481)
* Support aio_pika 8

- Fix tests for new shape of the AbstractConnection class
- Run tests against aio_pika 7 and 8

* Update CHANGELOG.md

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-05 11:54:21 +05:30
2519223a5c Audit and test opentelemetry-instrumentation-aiopg NoOpTracerProvider (#1606)
* Audit and test opentelemetry-instrumentation-aiopg NoOpTracerProvider

* Change line length

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 20:55:41 +00:00
a217682a39 Add a test for aws lambda using NoOpTracerProvider (#1602)
* add a test for aws lambda using NoOpTracerProvider

* fix import

* add assert for spans

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 19:41:30 +00:00
2b6f913790 Add Redis instrumentation query sanitization (#1572)
* Add Redis instrumentation query sanitization

Add a query sanitizer to the Redis instrumentation. This can be disabled
with the `sanitize_query = False` config option.

Given the query `SET key value`, the sanitized query becomes `SET ? ?`.
Both the keys and values are sanitized, as both can contain PII data.

The Redis queries are sanitized by default. This changes the default
behavior of this instrumentation. Previously it reported unsanitized
Redis queries.

This was previously discussed in the previous implementation of this PR
in PR #1571

Closes #1548

* Update Redis sanitize_query option documentation

Changes suggested in
https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572#discussion_r1066069584

* Remove uninstrument & instrument from test setup

The Redis test that performs the tests with the default options, doesn't
need to uninstrument and then instrument the instrumentor. This commit
removes the unnecessary setup code. The setup code is already present at
the top of the file.

* Fix code style formatting

* Update Redis functional tests

- Update the sanitizer to also account for a max `db.statement`
  attribute value length. No longer than 1000 characters.
- Update the functional tests to assume the queries are sanitized by
  default.
- Add new tests that test the behavior with sanitization turned off.
  Only for the tests in the first test class. I don't think it's needed
  to duplicate this test for the clustered and async setup combinations.

* Test Redis unsanitized queries by default

Change the Redis functional tests so that they test the unsanitized
query by default, and test the sanitized query results in the separate
test functions.

This is a partial revert of the previous commit
8d56c2f72e12c7d7dc4ef25a9fe6a69ea685a6d8

* Fix formatting issue in Redis utils

* Disable Redis query sanitization by default

Update the Redis instrumentation library to not change the default
behavior for the Redis instrumentation. This can be enabled at a later
time when the spec discussion about this topic has concluded.

https://github.com/open-telemetry/opentelemetry-specification/issues/3104

* Fix pylint issue

Remove else statement.

* Update changelog about Redis query sanitization default

[ci skip]

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

* Fix potential error on Redis args being 0

Check the length of the args array and return an empty string if there
are no args.

That way it won't cause an IndexError if the args array is empty and it
tries to fetch the first element, which should be the Redis command.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 14:22:23 +00:00
3770e574eb Add ability to exclude some routes explicitly with Django Instrumentation (#1618) 2023-02-03 15:14:28 -08:00
673e4aadb4 Record exception in Celery instrumentation (#1573)
* Add tests for errors in Celery tasks

I noticed there were no tests for the error scenario in the Celery
package. This commit adds a basic test, based on the previous test and
how I see other packages test the error status on the span.

Part of #987

* Record exception in Celery instrumentation

In addition to setting the status on the span, also record the exception
on the span. This adds an event to the span with more details about the
error, following the format other instrumentations also use.

* Update CHANGELOG with Celery record exception

* Fix lint code formatting issues

* Move Celery error tests to the functional tests

The celery tests failed on Python 3.11. This is most likely due to this
issue in billiard, a celery dependency, about it not working on Python
3.11 because of the error reported in the CI:
https://github.com/celery/billiard/issues/377

It's been fixed in billiard 4.1.0, but celery is locked on billiard
version lower than 4, so it cannot use this version with the fix.

This issue does not arise on the Docker tests, because they use Python
3.9.16.

I've moved the error test span event assertions to the error test that
is available in the functional tests, and removed the unit test. That
way, the build will run successfully.

* Remove duplicate entry in changelog

This was added in a recent merge commit on this PR branch.

* Remove unused test code

With the move of the tests for tasks with errors to the functional
tests, remove the unit test's error task and unused imports.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-03 04:30:57 +00:00
520e58d62a Update README.md (#1617) 2023-02-03 03:46:25 +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
d8788b68dd Flush meter provider at end of lambda function handler (#1613)
* Flush meter provider at end of lambda function handler

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Update `force_flush()` check based on PR feedback

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

---------

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2023-02-01 19:13:53 +05:30
6ed2c56eca Value of trace_configs might be None (#1592) 2023-01-31 10:51:15 +00:00
bbe7578d17 Fix sqlalchemy uninstrument (#1581) 2023-01-29 09:43:06 +05:30
a300d65ccf Update some environments to 3.10 (#1604)
Fixes #1603
2023-01-28 03:57:38 +05:30
1c27b775f2 [docs] Fixing examples formating (#1585) 2023-01-26 13:42:22 +00:00
810d9825cd mongo db - fix db statement capturing (#1512) 2023-01-24 03:15:28 +00:00
e1a1bada1f Remove update-sha workflow (#1594) 2023-01-24 01:24:01 +05:30