-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(api): Logic for include_feature_flag Query Parameter
#71668
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(api): Logic for include_feature_flag Query Parameter
#71668
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #71668 +/- ##
===========================================
+ Coverage 61.87% 77.91% +16.04%
===========================================
Files 3671 6556 +2885
Lines 113013 292004 +178991
Branches 18360 50468 +32108
===========================================
+ Hits 69925 227520 +157595
- Misses 42720 58228 +15508
- Partials 368 6256 +5888
|
| :pparam string organization_id_or_slug: the id or slug of the organization the | ||
| team should be created for. | ||
| :param string detailed: Specify '0' to retrieve details without projects and teams. | ||
| :qparam string include_feature_flags: whether or not to include feature flags in the response |
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.
nit: indent
| ) | ||
|
|
||
| if not include_feature_flags: | ||
| context.pop("features", 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.
Is there a way to prevent getting the data in the first place? This helps reduce the amount of bytes transferred on the network/wire and reduced the payload, but we are still taking a hit on the data lookup. Is that something you plan to do on a follow up?
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.
yeah, i am planning to modify the OrganizationSerializer so that I pass the qparam there and generate the list if the param is true.
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.
Okay, awesome! Is that going to be in this PR or another? Just so I know how to review
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.
ill follow up with another pr.
| context = serialize(organization, request.user, serializer(), access=request.access) | ||
|
|
||
| if not include_feature_flags: | ||
| context.pop("features", 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.
same comment as below for this
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
…gs (#71791) Followup on #71668 I refactored the serializers here so they accept a new kwarg - `include_feature_flag`. if the kwarg is passed, it will only determine the `features` field if the flag is `True`. This should reduce the amount of computation that we do if the response doesn't require feature flags.
In this final PR, I implement the logic to use the
include_feature_flaglogic and selective remove the "features" key from the response.Closes: https://github.com/getsentry/team-core-product-foundations/issues/326