-
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
feat(investigation): Add eventTypes filter on the API #202829
Conversation
b2b96d0
to
6cff219
Compare
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
@@ -8,7 +8,7 @@ | |||
*/ | |||
|
|||
import { z } from '@kbn/zod'; |
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 this none self-explanatory z
🤔 😆 ?
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.
Did I add that? I don't recall importing from @kbn/zod but that's probably just a wrapper around zod itself
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.
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 didn't know it before. Thanks!
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.
|
||
if ( | ||
annotationsClient && | ||
(includeAllEventTypes || params?.query?.eventTypes?.includes('annotation')) |
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 wonder how robust is this check params?.query?.eventTypes?.includes('annotation'))
? Do we have another way to check this?
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.
Zod ensures that if eventTypes
is present on the query parameters, then it is an array of event type (enum).
I could write the same check as params && params.query && params.query.eventTypes && params.queryEventTypes.includes('annotation')
but I would be reinventing optional chaining. I don't think it's more readable this way, but it's definitely more verbose 😅
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.
@fkanout Do you want me to address this somehow?
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.
@kdelemme thank you for explaining it; it's more clear now. My only concern is the hard-coded string annotation
type. If it's an enum, I would expect to use it instead.
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.
Ah yes good point. I forgot to parse the eventTypes: ac24d91
alignItems="flexStart" | ||
justifyContent="spaceBetween" | ||
responsive | ||
css={css` |
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.
Out of curiosity, why do we use the css
emotion in this inline style instead of the built-in style
?
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 tend to use it all the time, just in case I need to write nested selectors. But true it is not needed here, and style would work the same
Going to check the responsiveness, good catch |
@fkanout The responsiveness is already broken on main, I'm going to open a few tickets to keep track of these things |
onEventTypesSelected: (eventTypes: string[]) => void; | ||
} | ||
|
||
export function InvestigationTimelineFilterBar({ onEventTypesSelected }: Props) { |
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.
💬 Simplified (and renamed) the timeline filter bar: replaced uiSearch with dateRange eui component and moved the update function into here.
onSelected: (eventTypes: string[]) => void; | ||
} | ||
|
||
export function InvestigationEventTypesFilter({ onSelected }: Props) { |
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 event filter dropdown component
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. 💪🏻
@kdelemme leave it to you how to handle the annotation
enum if you think there is a better way. And to solve the merge conficlts.
⏳ Build in-progress
History
cc @kdelemme |
Starting backport for target branches: 8.x |
(cherry picked from commit 2ab38a3)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…#204089) # Backport This will backport the following commits from `main` to `8.x`: - [feat(investigation): Add eventTypes filter on the API (#202829)](#202829) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kevin Delemme","email":"kevin.delemme@elastic.co"},"sourceCommit":{"committedDate":"2024-12-12T16:49:34Z","message":"feat(investigation): Add eventTypes filter on the API (#202829)","sha":"2ab38a3664cf7f103ac1a57f664c736a8e3d495b","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.18.0"],"title":"feat(investigation): Add eventTypes filter on the API","number":202829,"url":"https://github.com/elastic/kibana/pull/202829","mergeCommit":{"message":"feat(investigation): Add eventTypes filter on the API (#202829)","sha":"2ab38a3664cf7f103ac1a57f664c736a8e3d495b"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202829","number":202829,"mergeCommit":{"message":"feat(investigation): Add eventTypes filter on the API (#202829)","sha":"2ab38a3664cf7f103ac1a57f664c736a8e3d495b"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Kevin Delemme <kevin.delemme@elastic.co>
Resolves #200800
🏇🏻 Summary
Note
I've implemented a basic UI selector using the existing EuiFilterGroup instead of the Figma UI that requires a more custom component. We can always iterate later.
This PR adds an optional
eventTypes
filter on the observability events API. The eventTypes string is checked against the event type enum, and transformed to an array for easier usage within the boundary of the server.When no specified, all event types are returned.
🍰 Boy/Girl scouts rule: I've also refactored/cleaned a few shenanigans I've introduced a while back in the Investigation context instead of leveraging react query context directly.
rca_filter_events.mov