Skip to content

Conversation

@psamecentreon
Copy link
Contributor

Refactor the Opsgenie event code to suit the apiv2 version by adding adaptations of the "write", "build_payload" and "send_data" functions.

@psamecentreon psamecentreon added the enhancement Enhance existing label Apr 11, 2022
@psamecentreon psamecentreon requested a review from tanguyvda April 11, 2022 15:48
@psamecentreon psamecentreon self-assigned this Apr 11, 2022
Comment on lines +276 to +280
if self.sc_event.event.categories == 1 then
local endpoint = self.sc_params.params.api_url .. url_path
else
local endpoint = self.sc_params.params.integration_api_token .. url_path
end
Copy link
Contributor

Choose a reason for hiding this comment

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

there, we have a little big issue :)

what does it mean ?
it means that depending on the type of event, we need to send them to a dedicated endpoint.

this is handled by the new lib sc_flush and we have a new parameter called send_mixed_events .

when do we need it ? when people want to send ba_status events.

force send_mixed_events to 0 when accepted_categories contains bam

change EventQueue:send_data(payload) to EventQueue:send_data(payload, info) (I'll need to do an update of the sc_flush module)

you'll also need to change [1] = function (payload) return self:send_data(payload) end and add the info parameter

the info method argument will only be available when we don't send mixed events and it will have the following structure

{
  "category_name"= "category_name",
  "category_id" = "category_id",
  "element_name" = "element_name",
  "element_id" = "element_id"
}

you'll then be able to transform your condition

@kduret
Copy link
Contributor

kduret commented Feb 24, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhance existing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants