Skip to content
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

[SLO] use terms aggregation to group by tags #174268

Merged
merged 11 commits into from
Jan 17, 2024

Conversation

mgiota
Copy link
Contributor

@mgiota mgiota commented Jan 4, 2024

Fixes #174328, #174332, #174335

MVP for grouping by tags for the different view modes

Screen.Recording.2024-01-16.at.23.29.22.mov

@mgiota mgiota self-assigned this Jan 4, 2024
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@mgiota mgiota mentioned this pull request Jan 5, 2024
})
.subscribe({
next: (response) => {
if (!isRunningResponse(response)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is isRunningResponse? Seems like a TIL moment for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think eventually we will get rid of this once we work on the paginated groups API , but let me summarize what it is about (or why I used it and what my inspiration was)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to use the ES search function similar to how we do it here, but for some reason I don't recall right now, I didn't have access to esClient or I didn't know how to use it. Then I started looking into alternatives on how I can use ES search method and I got inspired by this example.

I read more about ES search service here and here

But once we implement the group api, we will be able to simply use await this.esClient.search({...}) and get rid of the low lever search implementation I have here.

Does it make sense?

@mgiota mgiota force-pushed the slo_group_by_tags branch from 3f888b5 to b958438 Compare January 5, 2024 22:18
@mgiota mgiota marked this pull request as ready for review January 5, 2024 22:54
@mgiota mgiota requested a review from a team as a code owner January 5, 2024 22:54
@mgiota mgiota requested a review from dominiqueclarke January 5, 2024 22:54
@mgiota
Copy link
Contributor Author

mgiota commented Jan 8, 2024

@elasticmachine merge upstream

@botelastic botelastic bot added the Team:obs-ux-management Observability Management User Experience Team label Jan 8, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@mgiota mgiota linked an issue Jan 15, 2024 that may be closed by this pull request
@mgiota mgiota force-pushed the slo_group_by_tags branch from 5f6ebc4 to b958438 Compare January 16, 2024 09:18
@mgiota mgiota requested review from a team and shahinakmal as code owners January 16, 2024 09:35
@mgiota mgiota force-pushed the slo_group_by_tags branch 2 times, most recently from f4ad29a to e698305 Compare January 16, 2024 13:26
Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Nothing blocking that can't be done later in follow-up PRs.
I've just one thought about reusing in the grouping component. It should be possible don't you think? But again, can be done in a follow-up PR

isSelected={isGroupByPopoverOpen}
>
{i18n.translate('xpack.observability.slo.list.groupByType', {
defaultMessage: 'Group by {type}',
Copy link
Contributor

Choose a reason for hiding this comment

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

🍰 nit: instead of "Group by ungrouped" we could use "none" or we can keep type: "ungrouped" but change the text when ungrouped is selected: "No group selected", "none".
Anyway this can be done later.

Copy link
Contributor Author

@mgiota mgiota Jan 16, 2024

Choose a reason for hiding this comment

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

Yep this should be covered here cc @dominiqueclarke

According to the design it should say No grouping

Screenshot 2024-01-16 at 23 52 15

<>
{data &&
Object.keys(data).map((group) => {
return <GroupListView group={group} kqlQuery={kqlQuery} isCompact={isCompact} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you need a "key" prop to please react?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the change and now group is part of the key for the slo items.

Comment on lines 56 to 60
<>
<SloListItems
activeAlertsBySlo={activeAlertsBySlo}
sloList={results}
loading={isLoading || isRefetching}
error={isError}
isCompact={isCompact}
rulesBySlo={rulesBySlo}
/>
<EuiTablePagination
pageCount={Math.ceil(total / ITEMS_PER_PAGE)}
activePage={page}
onChangePage={handlePageClick}
itemsPerPage={ITEMS_PER_PAGE}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't you reuse component directly?

<SlosView
          sloList={results}
          loading={isLoading || isRefetching}
          error={isError}
          isCompact={isCompact}
          sloView={view}
        />

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep good idea! I was actually refactoring this as part of Group by and view modes and your suggestion works like a charm. I pushed the change

Screen.Recording.2024-01-16.at.23.01.13.mov

} = useKibana().services;

const { data, isLoading, isFetching } = useQuery({
queryKey: ['slos'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Like we talked about, you can use a unique key like ['slos', 'groups'] added in the x-pack/plugins/observability/public/hooks/slo/query_key_factory.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@mgiota mgiota linked an issue Jan 16, 2024 that may be closed by this pull request
@mgiota mgiota force-pushed the slo_group_by_tags branch from bc1093f to b6f1e83 Compare January 16, 2024 22:27
@mgiota mgiota assigned mgiota and unassigned mgiota Jan 16, 2024
@mgiota mgiota added the v8.13.0 label Jan 16, 2024
@@ -19,6 +19,7 @@ export const sloKeys = {
all: ['slo'] as const,
lists: () => [...sloKeys.all, 'list'] as const,
list: (filters: SloListFilter) => [...sloKeys.lists(), filters] as const,
groups: () => [...sloKeys.all, 'groups'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the groupBy filter to this function will be added as part of this #174329

@mgiota mgiota requested a review from kdelemme January 16, 2024 23:44
@mgiota mgiota force-pushed the slo_group_by_tags branch from 4b7dd20 to 374ba7c Compare January 16, 2024 23:48
@mgiota mgiota force-pushed the slo_group_by_tags branch from 374ba7c to be65bfe Compare January 16, 2024 23:57
@mgiota mgiota linked an issue Jan 17, 2024 that may be closed by this pull request
@mgiota mgiota force-pushed the slo_group_by_tags branch from b414803 to 2950725 Compare January 17, 2024 09:24
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #6 / RegisteredAttachmentsPropertyActions renders the correct number of actions

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observability 581 585 +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observability 600.7KB 604.4KB +3.6KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observability 101.2KB 101.3KB +89.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @mgiota

Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

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

MVP LGTM! 🚢

Comment on lines +51 to +65
<SlosView
sloList={results}
loading={isLoading || isRefetching}
error={isError}
isCompact={isCompact}
sloView={sloView}
group={group}
/>

<EuiTablePagination
pageCount={Math.ceil(total / ITEMS_PER_PAGE)}
activePage={page}
onChangePage={handlePageClick}
itemsPerPage={ITEMS_PER_PAGE}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome that we can reuse components

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

LGTM !

@mgiota mgiota merged commit 9b84690 into elastic:slo_group_feature Jan 17, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:obs-ux-management Observability Management User Experience Team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Group by with sorting and searching Group by and view modes MVP functionality for group by tags
7 participants