-
Notifications
You must be signed in to change notification settings - Fork 626
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
SQS Instrumentor doesn't work with the clients by using resource method #1699
Labels
bug
Something isn't working
Comments
mattoberle
added a commit
to mattoberle/opentelemetry-python-contrib
that referenced
this issue
Feb 9, 2024
This commit addresses the following open issues: - open-telemetry#1699 - open-telemetry#1996 There are four ways to access the SQS API via `boto3`: - `client = boto3.client("sqs")` - `client = boto3.Session().client("sqs")` - `sqs = boto3.resource("sqs")` - `sqs = boto3.Session().resource("sqs")` The existing wrapper tied into `boto3.client` to wrap a generated `botocore.client.SQS` class. The change here covers the three missing initialization methods.
8 tasks
mattoberle
added a commit
to mattoberle/opentelemetry-python-contrib
that referenced
this issue
Feb 12, 2024
This commit addresses the following open issues: - open-telemetry#1699 - open-telemetry#1996 There are four ways to access the SQS API via `boto3`: - `client = boto3.client("sqs")` - `client = boto3.Session().client("sqs")` - `sqs = boto3.resource("sqs")` - `sqs = boto3.Session().resource("sqs")` The existing wrapper tied into `boto3.client` to wrap a generated `botocore.client.SQS` class. The change here covers the three missing initialization methods.
ocelotl
added a commit
that referenced
this issue
Apr 22, 2024
* [boto3sqs] Instrument `Session` and `resource` This commit addresses the following open issues: - #1699 - #1996 There are four ways to access the SQS API via `boto3`: - `client = boto3.client("sqs")` - `client = boto3.Session().client("sqs")` - `sqs = boto3.resource("sqs")` - `sqs = boto3.Session().resource("sqs")` The existing wrapper tied into `boto3.client` to wrap a generated `botocore.client.SQS` class. The change here covers the three missing initialization methods. * update changelog * rename duplicate test methods * implement uninstrument * [boto3sqs] Reduce number of wrapper targets There are actually 6 ways to initialize a boto3 API object. ```py boto3.client() # Using default global session boto3.resource() # Using default global session boto3.Session().client() # Using "re-exported" session.Session boto3.Session().resource() # Using "re-exported" session.Session boto3.session.Session().client() # Using session.Session directly boto3.session.Session().resource() # Using session.Session directly ``` We only have to patch `session.Session.client` to catch all the cases. - https://github.com/boto/boto3/blob/b3c158c62aa2a1314dc0ec78caea1ea976abd1a0/boto3/session.py#L217-L229 - https://github.com/boto/boto3/blob/b3c158c62aa2a1314dc0ec78caea1ea976abd1a0/boto3/session.py#L446-L457 * Remove unused import --------- Co-authored-by: Matt Oberle <mattoberle@users.noreply.github.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe your environment
Python version:3.9.9
Cloud hosting Provider: aws
Library version: 0.37b0
Steps to reproduce
I have a SQS client.py,
in Init()
self.boto_session = boto3.session.Session()
later when I want to send_message, I use this:
What is the expected behavior?
What did you expect to see?
When I use auto-instrumentation, SQS instrument spans would be added automatically.
What is the actual behavior?
What did you see instead?
SQS instrumentation spans don't show up unless I call
after
res = self.boto_session.resource
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: