-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
}) | ||
.subscribe({ | ||
next: (response) => { | ||
if (!isRunningResponse(response)) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
x-pack/plugins/observability/public/hooks/slo/use_fetch_slo_groups.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability/public/hooks/slo/use_fetch_slo_groups.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/observability/public/pages/slos/components/grouped_slos/group_view.tsx
Outdated
Show resolved
Hide resolved
3f888b5
to
b958438
Compare
@elasticmachine merge upstream |
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
5f6ebc4
to
b958438
Compare
f4ad29a
to
e698305
Compare
There was a problem hiding this 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}', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
<> | ||
{data && | ||
Object.keys(data).map((group) => { | ||
return <GroupListView group={group} kqlQuery={kqlQuery} isCompact={isCompact} />; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
<> | ||
<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} | ||
/> |
There was a problem hiding this comment.
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}
/>
There was a problem hiding this comment.
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'], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
bc1093f
to
b6f1e83
Compare
@@ -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'], |
There was a problem hiding this comment.
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
4b7dd20
to
374ba7c
Compare
374ba7c
to
be65bfe
Compare
b414803
to
2950725
Compare
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @mgiota |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MVP LGTM! 🚢
<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} | ||
/> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
Fixes #174328, #174332, #174335
MVP for grouping by tags for the different view modes
Screen.Recording.2024-01-16.at.23.29.22.mov