-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/add boto3 sqs instrumentation #2
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
base: main
Are you sure you want to change the base?
Conversation
| # limitations under the License. | ||
| from typing import Collection | ||
|
|
||
| _instruments: Collection[str] = ("boto3 >= 1.21.46",) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this support older versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the one from boto3
| retval = super( | ||
| Boto3SQSInstrumentor.ContextableList, self | ||
| ).__getitem__(*args, **kwargs) | ||
| if isinstance(retval, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inverse the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| self._did_decorate = False | ||
|
|
||
| def _instrument(self, **kwargs: Dict[str, Any]) -> None: | ||
| self._did_decorate: bool = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use the is_instrumented_by_opentelemetry function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_instrumented_by_opentelemetry defines a different thing. From the code, its basically a switch that prevents calling instrument twice. self._did_decorate defines if the functions of botocore.client.SQS are wrapped (which is not necessarily true because by calling instrument without calling boto3.client("sqs") these functions will not be wrapped)
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.