-
Notifications
You must be signed in to change notification settings - Fork 32
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
[RHCLOUD-36086] Refactor Splunk integration actions to not use behavior group apis anymore #627
[RHCLOUD-36086] Refactor Splunk integration actions to not use behavior group apis anymore #627
Conversation
c7a3110
to
1430821
Compare
@vkrizan Could you please have a look to this PR? |
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.
Thank you @g-duval. There is one breaking change with the bundle events not being limited. See below.
@@ -33,26 +33,15 @@ Steps: | |||
["ff59b502-da25-4297-bd88-6934ad0e0d63"] <<- Behavior group ID |
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.
Can you please remove the comment (or update it)?
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.
Sure, and sorry I forgot to update comments
BehaviorGroupRequest, | ||
UUID, | ||
} from '../../../types/Notification'; | ||
import { UUID } from '../../../types/Notification'; | ||
|
||
export const SPLUNK_GROUP_NAME = 'SPLUNK_INTEGRATION'; | ||
export const SPLUNK_INTEGRATION_NAME = 'SPLUNK_AUTOMATION'; |
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.
Please remove the SPLUNK_BEHAVIOR_GROUP_NAME
constant.
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
const eventTypes = await getAllEventTypes(); | ||
|
||
const selectedEventTypes = eventTypes.filter((eventType) => { | ||
if (!eventType?.application) { | ||
return false; | ||
} | ||
|
||
if (eventType.application.bundle_id !== behaviorGroup.bundleId) { | ||
return false; |
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.
This part limited the event types to be part of a single bundle (RHEL/Insights). With this removal, this would attach events that match the name across all bundles. For example, Ansible has events not only for RHEL but also for OpenShift. Please update the event types selection to filter the bundle.
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.
That's right, thank you, I updated it.
onProgress(' ERROR!\n', 'pf-v5-u-danger-color-200'); | ||
console.log(error); | ||
} | ||
onProgress(' FETCHED\n', 'pf-v5-u-success-color-200'); |
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.
We can move this after the for-loop, as there is no async call in-between.
3c0f374
to
20a7d2e
Compare
@g-duval thats awesome thinking ahead! I wanted to create a JIRA and tackle this within our team next quarter. I'd probably wait a bit and maybe sync on it more. Right now the new integrations flow is in development and we are missing 2 or 3 features from full feature rediness. Or is this just updating current splunk flow? We will probably revisit the new wizard with option to include splunk in it with UX as well. |
|
||
await attachEvents(behaviorGroup, events, onProgress); | ||
const getbundleTabs = () => { | ||
if (getBundles.payload?.status === 200) { |
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.
Isn't the getBundles
an async function that needs to be called?
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.
Well I'm not sure, it is not used as async in other places of this project, so I used the same way to use it to be consistent.
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.
Is this the imported function?:
notifications-frontend/src/services/Notifications/GetBundles.ts
Lines 10 to 13 in 23f50fc
export const useGetBundles = ( | |
includeApplications?: boolean, | |
initFetch = true | |
) => useQuery(getBundlesAction(!!includeApplications), initFetch); |
Can you please double check?
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 feel like there is an incorrect wiring of these hooks. The ones that are created in this module do call async functions, and are hooks due to the frameworks that they take request capabilities from. The useGetBundle
would create a hook useQuery
of react-fetching-library. The useQuery is set to issue the request immediately when the hook is created, triggering a rerender. Should the async function of useSplunkSetup
was called immedeately or before the useGetBundles
finishes loading, it would fail with the "error fetching bundle ...".
I recommend to set initFetch = false
and then use query
variable to manually call async request at the right time. See https://marcin-piela.github.io/react-fetching-library/#/?id=usequery
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.
Ok thank you, I updated this part, could you please have a look? BTW I also used an existing method to retrieve only one bundle.
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.
Thank you. It looks good. One minor thing, you might bring back a onProgress()
before calling the async getBundle stuff to announce that step to the user.
Hi @karelhala , yes the idea is to update only the current Splunk integration to move away from behavior group API as soon as possible, because we don't want to implement behavior groups model in Kessel for couple of month only. |
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.
Looks good.
If possible, please test it out before merging.
Thank you!
/retest |
Yes I developed and tested it using stage backend, but I will definitely test it again when it will be deployed in stage. |
Description
Since we are moving away from Notifications behavior groups, Splunk integration have to be updated.
It's now possible create an integration and to link it to sevral event types of sevral bundles with a single request.
RHCLOUD-36086
Checklist ☑️