Skip to content

ref(insights): Combine data loading + widget rendering for Insights -> Http pages #89325

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

Merged

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Apr 10, 2025

As part of an effort to be able to deeplink to charts via the Releases Drawer, we need to move data fetching + chart rendering into a self-contained component (with a unique id).

This refactors the widgets on httpLandingPage and httpDomainSummaryPage so that we get an idea of what this will look like before continuing on to do others.

…> Http pages

As part of an effort to be able to [deeplink to charts via the Releases Drawer](#88560), we need to move data fetching + chart rendering into a self-contained component (with a unique id).

This refactors the widgets on `httpLandingPage` and `httpDomainSummaryPage` so that we get an idea of what this will look like.
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 10, 2025
import {BASE_FILTERS} from 'sentry/views/insights/http/settings';
import {SpanMetricsField} from 'sentry/views/insights/types';

export function useHttpDomainSummaryFilter() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Are these generally pretty static per "page"?

Copy link
Member

Choose a reason for hiding this comment

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

Generally, all charts at the top of a page share filters, and the table under them has its own set of filters that's close to, but not exactly the same as the chart filters. So, this hook might be better if the word Chart appeared in it?

Comment on lines 12 to 14
isPending: isDurationDataLoading,
data: durationData,
error: durationError,
Copy link
Member Author

Choose a reason for hiding this comment

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

probably don't need these aliases? maybe makes it easier to read the diffs as we're transitioning

Copy link
Member

Choose a reason for hiding this comment

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

You can remove the aliases if you want. The aliases help a lot when fetching multiple series per page

Copy link
Member Author

Choose a reason for hiding this comment

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

Gonna leave them for now, we can go back to update it later

@@ -22,14 +18,15 @@ import {ModulePageProviders} from 'sentry/views/insights/common/components/modul
import {ModuleBodyUpsellHook} from 'sentry/views/insights/common/components/moduleUpsellHookWrapper';
import {ReadoutRibbon, ToolRibbon} from 'sentry/views/insights/common/components/ribbon';
import {getTimeSpentExplanation} from 'sentry/views/insights/common/components/tableCells/timeSpentCell';
import {useHttpDomainSummaryFilter} from 'sentry/views/insights/common/components/widgets/hooks/useHttpDomainSummaryFilter';
import HttpDomainSummaryDurationWidget from 'sentry/views/insights/common/components/widgets/httpDomainSummaryDurationWidget';
Copy link
Member Author

Choose a reason for hiding this comment

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

See https://github.com/getsentry/sentry/pull/89045/files#diff-886e46c8485496b33137c9770f4eb4fb6e1085c7e6e0fbafdd5721d4310b74e3R33-R62 on how we're going to use these widgets -- these are default exports to make it easier to dynamically import and render.

@@ -260,6 +260,8 @@ describe('HTTPLandingPage', function () {
it('fetches module data', async function () {
render(<HTTPLandingPage />, {organization});

await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-indicator'));
Copy link
Member Author

Choose a reason for hiding this comment

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

Oh this was from the PoC where we dynamically loaded the widgets. Still makes sense here that we'd wait for loading components to go away before we check the mocked requests.

@billyvg billyvg marked this pull request as ready for review April 10, 2025 19:58
@billyvg billyvg requested a review from a team as a code owner April 10, 2025 19:58
@billyvg billyvg requested a review from gggritso April 10, 2025 19:58
Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

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

Great! I'm happy to mash approve, but I also wanted to ask about the names. Tables are also technically widgets, so I think it'd be clearer if the components and their IDs has Chart in them somewhere, or were namespaced in a folder that specified they're charts. Not huge, but would help!

import {BASE_FILTERS} from 'sentry/views/insights/http/settings';
import {SpanMetricsField} from 'sentry/views/insights/types';

export function useHttpDomainSummaryFilter() {
Copy link
Member

Choose a reason for hiding this comment

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

Generally, all charts at the top of a page share filters, and the table under them has its own set of filters that's close to, but not exactly the same as the chart filters. So, this hook might be better if the word Chart appeared in it?

Comment on lines 12 to 14
isPending: isDurationDataLoading,
data: durationData,
error: durationError,
Copy link
Member

Choose a reason for hiding this comment

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

You can remove the aliases if you want. The aliases help a lot when fetching multiple series per page

Copy link
Member Author

Choose a reason for hiding this comment

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

lol Cursor decided to rewrite this file?????????????????????

@billyvg billyvg force-pushed the ref-insights-combine-data-fetching-with-chart-rendering branch from 54bf4ae to 646513f Compare April 11, 2025 14:22
@billyvg
Copy link
Member Author

billyvg commented Apr 11, 2025

Renamed everything to include Chart in its names

@billyvg billyvg merged commit 56d8dad into master Apr 11, 2025
41 checks passed
@billyvg billyvg deleted the ref-insights-combine-data-fetching-with-chart-rendering branch April 11, 2025 17:05
DominikB2014 added a commit that referenced this pull request Apr 14, 2025
This broke in #89325

We should be passing in `location.query.domainsSort` into decodeSorts
and not the string `domainsSort`!
Also added a test case to ensure sort always works off the query param
billyvg pushed a commit that referenced this pull request Apr 14, 2025
This broke in #89325

We should be passing in `location.query.domainsSort` into decodeSorts
and not the string `domainsSort`!
Also added a test case to ensure sort always works off the query param
gggritso added a commit that referenced this pull request Apr 17, 2025
Part of #88560
Follow-up to #89325

---------

Co-authored-by: George Gritsouk <989898+gggritso@users.noreply.github.com>
andrewshie-sentry pushed a commit that referenced this pull request Apr 22, 2025
…> Http pages (#89325)

As part of an effort to be able to [deeplink to charts via the Releases
Drawer](#88560), we need to
move data fetching + chart rendering into a self-contained component
(with a unique id).

This refactors the widgets on `httpLandingPage` and
`httpDomainSummaryPage` so that we get an idea of what this will look
like before continuing on to do others.
andrewshie-sentry pushed a commit that referenced this pull request Apr 22, 2025
This broke in #89325

We should be passing in `location.query.domainsSort` into decodeSorts
and not the string `domainsSort`!
Also added a test case to ensure sort always works off the query param
andrewshie-sentry pushed a commit that referenced this pull request Apr 22, 2025
Part of #88560
Follow-up to #89325

---------

Co-authored-by: George Gritsouk <989898+gggritso@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 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.

2 participants