Skip to content

ref(usageStatsOrg): Convert component from class to function + useApiQuery#90884

Merged
priscilawebdev merged 16 commits into
masterfrom
priscila/ref/usage-stats-org/convert-from-class-to-func
May 12, 2025
Merged

ref(usageStatsOrg): Convert component from class to function + useApiQuery#90884
priscilawebdev merged 16 commits into
masterfrom
priscila/ref/usage-stats-org/convert-from-class-to-func

Conversation

@priscilawebdev

@priscilawebdev priscilawebdev commented May 5, 2025

Copy link
Copy Markdown
Member

Contributes to the initiative https://www.notion.so/sentry/Frontend-TSC-Project-Convert-DeprecatedAsyncComponent-to-FC-useApiQuery-1ac8b10e4b5d8050b8f0d4a62a08526b?cookie_sync_completed=true

closes TET-376

Note
Compared several data points against production, and everything looks good, but I appreciate more checks

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 5, 2025
@priscilawebdev priscilawebdev changed the title fix: handle deleted org in ingest pipelines (#90877) ref(usageStatsOrg): Convert component from class to function + useApiQuery May 5, 2025
@codecov

codecov Bot commented May 5, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #90884      +/-   ##
==========================================
+ Coverage   87.63%   87.82%   +0.19%     
==========================================
  Files       10324    10293      -31     
  Lines      585809   581955    -3854     
  Branches    22628    22417     -211     
==========================================
- Hits       513396   511130    -2266     
+ Misses      71985    70411    -1574     
+ Partials      428      414      -14     

@priscilawebdev priscilawebdev force-pushed the priscila/ref/usage-stats-org/convert-from-class-to-func branch from e267649 to ea1d06f Compare May 5, 2025 21:59
Comment on lines -55 to -60
/**
* We allow 403s since we don't know if spike protection is enabled for the project or not
* If not, don't raise an error since we can still show usage data.
* We allow 404s in case they don't have access to new spike protection just yet
*/
const ALLOWED_STATUSES = new Set([403, 404]);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Now we are using useApiQuery and will not block the whole page if an endpoint fails. I believe this no longer makes sense

…' of github.com:getsentry/sentry into priscila/ref/usage-stats-org/convert-from-class-to-func
@priscilawebdev priscilawebdev marked this pull request as ready for review May 6, 2025 07:50
@priscilawebdev priscilawebdev requested a review from a team as a code owner May 6, 2025 07:50
@priscilawebdev priscilawebdev requested review from a team and TkDodo May 6, 2025 07:50

@TkDodo TkDodo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙌 that was a big one

Comment thread static/app/views/organizationStats/usageStatsOrg.tsx Outdated
Comment thread static/app/views/organizationStats/usageStatsOrg.tsx Outdated
Comment thread static/app/views/organizationStats/usageStatsOrg.tsx Outdated
Comment thread static/gsApp/hooks/spendVisibility/enhancedUsageStatsOrganization.tsx Outdated
priscilawebdev and others added 3 commits May 6, 2025 11:32
…ion.tsx

Co-authored-by: Dominik Dorfmeister <dominik.dorfmeister@sentry.io>
Co-authored-by: Dominik Dorfmeister <dominik.dorfmeister@sentry.io>
…' of github.com:getsentry/sentry into priscila/ref/usage-stats-org/convert-from-class-to-func

export interface UsageStatsOrganizationProps {
dataCategory: DataCategory;
dataCategoryApiName: DataCategoryInfo['apiName'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i know you didn't touch this in your pr but i think this type is wrong LOL, i can tackle this if you don't here though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

why do you think this type is wrong?

Comment on lines +352 to +360
const orgStatsQuery =
endpointQuery ??
getEndpointQuery({
dataCategoryApiName,
dataDatetime,
organization,
projectIds,
endpointQueryDatetime: getEndpointQueryDatetime(dataDatetime),
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this probably needs to be memoized if its being used as a dependency later since it will create a new object every render

@priscilawebdev priscilawebdev merged commit 24bedb7 into master May 12, 2025
42 checks passed
@priscilawebdev priscilawebdev deleted the priscila/ref/usage-stats-org/convert-from-class-to-func branch May 12, 2025 06:07
@sentry

sentry Bot commented May 13, 2025

Copy link
Copy Markdown
Contributor

Suspect Issues

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

  • ‼️ TypeError: Cannot read properties of null (reading 'toFixed') /stats/ View Issue

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

@github-actions github-actions Bot locked and limited conversation to collaborators May 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants