You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[boto3sqs] Instrument Session and resource (#2161)
* [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 <[email protected]>
Co-authored-by: Diego Hurtado <[email protected]>
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py
0 commit comments