Skip to content

Conversation

@majorgreys
Copy link
Contributor

Description

Since #1938 we had exposed how we were not checking values before setting tags, causing TypeErrors to be raised if the value was being set to None. This PR adds checks around those cases where the value can be None.

Checklist

  • Added to the correct milestone.
  • Tests provided or description of manual testing performed is included in the code or PR.
  • Library documentation is updated.
  • Corp site documentation is updated (link to the PR).

@majorgreys majorgreys requested a review from a team as a code owner May 14, 2021 17:33
@majorgreys
Copy link
Contributor Author

@Mergifyio backport 0.48

@majorgreys majorgreys added this to the 0.49.0 milestone May 14, 2021
@mergify
Copy link
Contributor

mergify bot commented May 14, 2021

Command backport 0.48: pending

Waiting for the pull request to get merged

P403n1x87
P403n1x87 previously approved these changes May 14, 2021
brettlangdon
brettlangdon previously approved these changes May 14, 2021
@majorgreys majorgreys dismissed stale reviews from brettlangdon and P403n1x87 via 52b8d20 May 14, 2021 19:02
Copy link
Member

@Kyle-Verhoog Kyle-Verhoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm we've been bitten a few times now with _set_str_tag and None. I think the solution here is good for now but perhaps we should handle the case in _set_str_tag since we can't get type verification in our integrations.

(None, None, [mock.call("span.kind", "client")]),
],
)
def test_set_grpc_client_meta(host, port, calls):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of this pattern because it's a bit removed from what could happen realistically in the integration - but I also understand that it's hard to replicate these scenarios

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think in this case I opted to go the unit testing route rather than an integration test because it's unclear how we could reproduce such a scenario. We could spend some time moving forward with rethinking these tests though.

@mergify mergify bot merged commit c08f02a into DataDog:master May 14, 2021
mergify bot added a commit that referenced this pull request May 14, 2021
* fix(grpc): handle None values for tags

* handle empty hostname in Python 2.7

* correct coercion of hostname

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit c08f02a)
@mergify
Copy link
Contributor

mergify bot commented May 14, 2021

Command backport 0.48: success

Backports have been created

brettlangdon added a commit that referenced this pull request May 17, 2021
* fix(grpc): handle None values for tags

* handle empty hostname in Python 2.7

* correct coercion of hostname

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit c08f02a)

Co-authored-by: Tahir H. Butt <tahir.butt@datadoghq.com>
Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants