Skip to content
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

feat(python): validate and clean up the result of the grouping function #272

Merged
merged 2 commits into from
Jul 8, 2021

Conversation

RyanGWU82
Copy link
Contributor

🧰 What's being changed?

PayloadBuilder now validates the output of the grouping function. If the output isn't a dict or doesn't include api_key or id, we log an error and don't send the request to ReadMe. If the output is missing other expected fields email and label, we log a warning but send the request anyway. And if the output includes any unexpected fields, we log a warning and remove them before sending the request to ReadMe.

Note that by default the logger is set to log level CRITICAL so users won't typically see these warnings and errors unless they modify the logger in the MetricsApiConfig object. I actually think that's fine—we want the metrics clients to be pretty transparent and not pollute our users' logs when they haven't opted in for that.

🧪 Testing

New unit tests.

@RyanGWU82 RyanGWU82 requested a review from erunion July 8, 2021 23:47
@erunion erunion requested a review from emilyskuo July 8, 2021 23:47
@RyanGWU82 RyanGWU82 merged commit 22b40cd into python-next Jul 8, 2021
@RyanGWU82 RyanGWU82 deleted the python-metrics-client-validate-the-rm-1306 branch July 8, 2021 23:55
domharrington pushed a commit that referenced this pull request Apr 19, 2022
…on (#272)

* feat(python): validate and clean up the result of the grouping function

* Update packages/python/readme_metrics/PayloadBuilder.py

Co-authored-by: Jon Ursenbach <[email protected]>

Co-authored-by: Jon Ursenbach <[email protected]>
@erunion erunion added python Issues related to our Python SDK and removed area:python labels Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Issues related to our Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants