-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Monkey Patch for Gevent #218
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
harrryr
force-pushed
the
fix-gunicorn
branch
3 times, most recently
from
June 24, 2024 22:18
9bb0abb
to
767c3d9
Compare
harrryr
force-pushed
the
fix-gunicorn
branch
2 times, most recently
from
June 25, 2024 20:59
f4b552b
to
72878e0
Compare
harrryr
force-pushed
the
fix-gunicorn
branch
2 times, most recently
from
June 25, 2024 21:45
4d4635f
to
cbd5f28
Compare
srprash
reviewed
Jun 26, 2024
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_instrumentation_patch.py
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_instrumentation_patch.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_instrumentation_patch.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_instrumentation_patch.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_instrumentation_patch.py
Outdated
Show resolved
Hide resolved
harrryr
force-pushed
the
fix-gunicorn
branch
15 times, most recently
from
July 4, 2024 00:00
81e034c
to
431ab46
Compare
srprash
reviewed
Jul 5, 2024
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_instrumentation_patch.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_instrumentation_patch.py
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/patches/_instrumentation_patch.py
Outdated
Show resolved
Hide resolved
srprash
approved these changes
Jul 5, 2024
thpierce
approved these changes
Jul 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Some customers are using gevent in their Python application with opentelemetry, and this causes the application to crash due to
maximum recursion depth exceeded
error. This is becausegevent
uses a specific version of thessl
module and runsmonkey.patch_all()
to patch the ssl module to the required version.The
monkey
command patches already existing modules to the required version, which may cause problems if there are other applications already using the module before monkey is ran.Because Opentelemetry is also using the
ssl
module , it creates a conflict and causes the application to crash. The recommended solution is to runmoneky.patch_all()
in opentelemetry beforehand so that such conflicts do not occur.Description of changes:
The issue experienced by customers is specifically due to the
ssl
module, therefore, we can run monkey.patch_ssl() command to only monkey thessl
module and reduce the scope. The distro will check if the customer application has thegevent
module installed, and if so, run themonkey.patch_ssl()
.Test
Built opentelemetry docker image with the change, modified the operator to install opentelemetry on sample python application with the image. Checked that the sample application has opentelemetry running and doesn't crash when APIs are called.
Test run: https://github.com/aws-observability/aws-otel-python-instrumentation/actions/runs/9813426624
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.