Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a way to customize the Alert Filter for the gitlab integration

Alberto Ruis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 4, 2020

My use case is that I want to create an alert if a job event has failed. 
I do realize that the current functionality for Job Event isn't listed
https://docs.opsgenie.com/docs/gitlab-integration

But in the Advanced setting in the integration I'm able to create alert policy when the Object Kind is equal to build, likely due to the fact both merge request and job events have the key object_kind in the payload
https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#job-events
https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#merge-request-events

 I do also  have the ability to get at items in the payload via the dynamic fields feature i.e. {{_payload.build_status }} https://docs.opsgenie.com/docs/draggable-fields#using-raw-parameters-from-webhook-url-payload-and-headers


While I can get access to the items in the payload in the Value field in an alert filter,
I can't set in the initial field we're looking at initially, see the screenshot on what I mean.

Opsgenie_-_Integration.png


There's the API integration, https://docs.opsgenie.com/docs/api-integration, but it doesn't support dynamic fields from the payload, I do see an Extra Properties fields that I could set but it doesn't integrate easily as the current gitlab integration i.e. formatting the request and authorization.


Thoughts? 

 

2 answers

1 accepted

0 votes
Answer accepted
Chris DeGidio
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2020

Hi Alberto, 

I hope this answer finds you well and you are having a great day.

To start off I will go ahead and submit a feature request to our engineering team for the functionality of adding that field as a draggable field to the GitLab integration so that you can then use the filtering within the create action. 

As a work-around though I could suggest that you utilize global policies/team routing rules depending upon how you have the integration current configured. For example, if this is a global integration you could set up that status to be pulled into the extra properties section of the alert and then you will be able to apply a filter condition based on that key-value pair via global policies, team policies, and team routing rules. 

For example in this first screenshot I setup the global policy to match for the failed build and assign a team to that alert. This would be possible with the integration being global (not assigned to a specific team) 

In the second screenshot, I am showing you how you could handle this on the alert routing rule portion if the integration is assigned to a team. Whenever the integration is assigned to a team and an alert is created via that integration the team's routing rules will be assessed. What this will do is essentially route the alert to nobody if the key value of build status failed is not in the alert. You could then set up a team notification policy to auto close those alerts that hit the team but are not routed anywhere. The final screenshot is what that would look like under the team that owns the integration. 

 Please let me know if there are any further questions. Thanks so much

Chris DeGidio
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2020

This is a followup reply since it seems the screenshots I had created for you did not show. Opsgenie_-_Apache-ops1.jpgOpsgenie_-_Apache-ops12.jpgOpsgenie_-_Policies.jpg

Pete Sam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 9, 2021

hi, have you ever heard back from your engineering team regarding the feature request? 
I dont get how you add global policies/team routing rules. I dont seem to have the permission to setup such things, as I can only see my team in the teams view. or is there a way to add custom draggable fields (attributes)? or only as admin?

what is a "global integration"? I could use API integration but this wont work with Gitlab as the auth-token cannot be send via GET request in API v2 of Opsgenie... and I guess the fields wont macht.

why dont you just expose "object_attributes" (with a custom textfield for subfields or something) like you already do for "object_kind" "Filter> Match conditions". then your team does not have to add attributes and users can use ANY attribute?

{ 
"object_kind": "pipeline",
"object_attributes":
{
"id": 31,
"ref": "master",
"status": "success",
[...]

just need to check the status of a pipeline...

aka {{_payload.object_attributes.status}} as Filter

greetz and thx 

Like # people like this
camila.naranjo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 27, 2021

Do you found any way to do it? I have the same problem

Like Jan Hübner likes this
Stefan Kleff
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 26, 2022

Same here :/

And the solution is super quick to implement. 

1 vote
Emiliano Fernando Cicarelli April 29, 2023

hi, have you ever heard back from your engineering team regarding the feature request? 

tks,

Emiliano

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events