-
Notifications
You must be signed in to change notification settings - Fork 395
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
[boto] Default to None if no region #526
Conversation
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.
One change in the meta list. Do we have a way to introduce a test to avoid a regression?
ddtrace/contrib/boto/patch.py
Outdated
'aws.region': region_name, | ||
"aws.agent": "boto", | ||
"aws.operation": operation_name, | ||
"aws.region": region_name, |
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.
with the None
default, get_region_name(region)
returns None
. Maybe we should add aws.region
tag only if it's not none?
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'd prefer this behaviour, but I opted to stay consistent with the functionality of line 143:
dd-trace-py/ddtrace/contrib/boto/patch.py
Line 143 in 56cb63f
region = getattr(instance, "region", None) |
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.
This will result in the region tag showing up as 'None'
, which isn't ideal. Let's not add it if it's none.
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.
exactly, let's not add it if it's None
Giving it a quick look, the |
ddtrace/contrib/boto/patch.py
Outdated
} | ||
if region_name: | ||
meta["aws.region"] = region_name |
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.
can you move these as a constants? better in a constants.py
module. So they're all in one place + you use the same variable in 2 parts of the code
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.
Looks good. Probably would be good to queue a follow-up task to make an upstream patch to moto to allow region to be empty and then provide a test here.
Fixes #525, also applies formatting.