* 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>
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>
* 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>
* 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>
* add a test for aws lambda using NoOpTracerProvider
* fix import
* add assert for spans
---------
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
* 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 #1571Closes#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>
* 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>
* 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>
* 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>