Skip to content

Conversation

@iamrajjoshi
Copy link
Collaborator

In this final PR, I implement the logic to use the include_feature_flag logic and selective remove the "features" key from the response.

Closes: https://github.com/getsentry/team-core-product-foundations/issues/326

@iamrajjoshi iamrajjoshi self-assigned this May 29, 2024
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 29, 2024
@iamrajjoshi iamrajjoshi requested a review from a team May 29, 2024 16:42
@iamrajjoshi iamrajjoshi marked this pull request as ready for review May 29, 2024 16:42
@iamrajjoshi iamrajjoshi requested a review from a team as a code owner May 29, 2024 16:42
@codecov
Copy link

codecov bot commented May 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.91%. Comparing base (628f41d) to head (f76e3e9).
Report is 19 commits behind head on master.

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     
Files Coverage Δ
src/sentry/api/endpoints/organization_details.py 87.03% <100.00%> (ø)

... and 2884 files with indirect coverage changes

: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
Copy link
Member

Choose a reason for hiding this comment

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

nit: indent

@iamrajjoshi iamrajjoshi enabled auto-merge (squash) May 29, 2024 18:20
)

if not include_feature_flags:
context.pop("features", None)
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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

Copy link
Collaborator Author

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.

@iamrajjoshi iamrajjoshi disabled auto-merge May 29, 2024 18:21
context = serialize(organization, request.user, serializer(), access=request.access)

if not include_feature_flags:
context.pop("features", None)
Copy link
Contributor

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

@iamrajjoshi iamrajjoshi merged commit 2a729a8 into master May 29, 2024
@iamrajjoshi iamrajjoshi deleted the raj/api/remove-ff-from-org-detail-response branch May 29, 2024 18:52
@sentry
Copy link

sentry bot commented May 30, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AttributeError: 'NoneType' object has no attribute 'pop' /api/0/organizations/{organization_id_or_slug}/ View Issue

Did you find this useful? React with a 👍 or 👎

iamrajjoshi added a commit that referenced this pull request Jun 3, 2024
…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.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants