Skip to content

feat(new-widget-builder-experience): Add Metrics dataset - Part 1 - [DD-537]#33047

Merged
priscilawebdev merged 9 commits intomasterfrom
feat/new-widget-builder-experience-add-metrics-data-set
Apr 5, 2022
Merged

feat(new-widget-builder-experience): Add Metrics dataset - Part 1 - [DD-537]#33047
priscilawebdev merged 9 commits intomasterfrom
feat/new-widget-builder-experience-add-metrics-data-set

Conversation

@priscilawebdev
Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev commented Mar 29, 2022

  • Enable Release DataSet
  • Create the hooks useMetricTags and useMetricMetags + Tests
  • Add Release SeachBar to the widget Builder
  • Add Test to verify if the release data set is rendered
  • Update MetricsTagStore and MetricsMetaStore to have the flag loaded

Preview:

Screen.Recording.2022-04-03.at.14.24.11.mov

@priscilawebdev priscilawebdev changed the title feat(new-widget-builder-experience): Add Metrics dataset wip: feat(new-widget-builder-experience): Add Metrics dataset Mar 29, 2022
@priscilawebdev priscilawebdev changed the title wip: feat(new-widget-builder-experience): Add Metrics dataset wip: feat(new-widget-builder-experience): Add Metrics dataset - Part 1 Mar 30, 2022
@priscilawebdev priscilawebdev changed the title wip: feat(new-widget-builder-experience): Add Metrics dataset - Part 1 wip: feat(new-widget-builder-experience): Add Metrics dataset - Part 1 - [DD-537] Mar 30, 2022
export default withIssueTags(IssuesSearchBar);
const IssuesSearchBar = withIssueTags(IssuesSearchBarContainer);

export {IssuesSearchBar};
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.

Thank you. I wasn't quite sure how to do the named export with the HoC so this is good. I realized the tests are failing elsewhere because this IssuesSearchBar is shared with the modal, we need to update the import in issueWidgetQueriesForm.tsx. I'll push a commit up

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 think you can also do export const IssuesSearchBar = withIssueTags(IssuesSearchBarContainer); 😄

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2022

size-limit report 📦

Path Size
src/sentry/static/sentry/dist/entrypoints/app.js 61.15 KB (+0.02% 🔺)
src/sentry/static/sentry/dist/entrypoints/sentry.css 69.97 KB (0%)

@priscilawebdev priscilawebdev changed the title wip: feat(new-widget-builder-experience): Add Metrics dataset - Part 1 - [DD-537] feat(new-widget-builder-experience): Add Metrics dataset - Part 1 - [DD-537] Apr 3, 2022

export function useMetricMetas() {
const api = useApi();
const organization = useOrganization();
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.

When I go into a dashboard and try to add from the 'Add Widget' button, I get an error saying useOrganization called but organization is not set

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.

this shouldn't happened :/ the OrganizationContainerContext is wrapping the whole app... I will take a look into it...thanks.

onSearch={handleSearch(queryIndex)}
/>
) : (
<ReleaseSearchBar
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.

As an aside, not related to the work here (I'll create a separate ticket to track it) we should probably only show recent searches related to the dataset you're in!

Screen Shot 2022-04-04 at 1 28 07 PM

Copy link
Copy Markdown
Member

@shruthilayaj shruthilayaj Apr 4, 2022

Choose a reason for hiding this comment

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

when I add stuff to the filter and click outside to onBlur, it resets the selected fields to events defaults

Copy link
Copy Markdown
Member

@shruthilayaj shruthilayaj Apr 4, 2022

Choose a reason for hiding this comment

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

Order bys also are broken, they show issue fields (I guess the search bar and order by isn't in the scope of this PR?) if so, can we just remove the fields? for now?

Copy link
Copy Markdown
Member Author

@priscilawebdev priscilawebdev Apr 5, 2022

Choose a reason for hiding this comment

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

I've one more PR on the top of this one for the sortBy #33241

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.

when I add stuff to the filter and click outside to onBlur, it resets the selected fields to events defaults

yes this was fixed in the follow-up PRs

Copy link
Copy Markdown
Contributor

@edwardgou-sentry edwardgou-sentry left a comment

Choose a reason for hiding this comment

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

I'm not that familiar with all the release metrics context but code looks good to me. Just had a few observations but I dont think any of them are blockers

Comment on lines +353 to +355
(prevState.displayType === DisplayType.TABLE &&
widgetToBeUpdated?.widgetType &&
WIDGET_TYPE_TO_DATA_SET[widgetToBeUpdated.widgetType] === DataSet.ISSUES) ||
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.

Hmm I wonder if this part of the condition is necessary? Looks like it's going to run any time we switch to the table visualization when editing an issue widget. I notice some behaviour differences in the builder depending on the widget type due to this (switching to table display on an existing discover widget behaves differently from an existing issue widget even if you already edited the both widgets to the exact same state).

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.

Not a blocker though, this doesn't seem like part of what this PR is addressing. We can also discuss details offline

Comment on lines +18 to +28
useEffect(() => {
let unmounted = false;

if (!unmounted && shouldFetchMetricTags) {
fetchMetricsTags(api, organization.slug, selection.projects);
}

return () => {
unmounted = true;
};
}, [selection.projects, organization.slug, shouldFetchMetricTags]);
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.

Not a blocker, but I think it's possible for fetchMetricsTags to be ran multiple times if it is not loaded and useMetricTags is used multiple times on the same page. This is because the loaded variable is only set to true after the request to metrics/tags/ is finished so multiple requests can happen if they are fired at the same time.

Maybe we can investigate reducing this to a single request by having some kind of state for loading in the store (i think useProjects does something similar)? I think this also applies for useMetricMetas. Again, not a blocker.

Copy link
Copy Markdown
Member Author

@priscilawebdev priscilawebdev Apr 5, 2022

Choose a reason for hiding this comment

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

yes I've noticed that and was talking about it with @narsaynorath yesterday... that's why we are still keeping the fetching(tags and fields) on the top of the widget builder, but that's something we want to improve and will investigate afterward

@priscilawebdev priscilawebdev merged commit de17ee9 into master Apr 5, 2022
@priscilawebdev priscilawebdev deleted the feat/new-widget-builder-experience-add-metrics-data-set branch April 5, 2022 06:24
@priscilawebdev
Copy link
Copy Markdown
Member Author

@edwardgou-sentry I'm addressing your feedback in a follow-up PR 😉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants