Fetch all values from properties

Tifenn Le Goff
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!
December 24, 2024

Hey,
We're using Opsgenie with Coralogix integration. We have the properties `{{_payload.alert_value}}` with the the following value

[{"labels":{"topic":"my-favorite-kafka-topic"},"percentageOverThreshold":100000,"avgValueCrossingThreshold":256686.56666666668,"maxValuesCrossingThreshold":273866,"minValuesCrossingThreshold":242031}]


Is there a function to fetch all value and generate content like this?


topic: 
my-favorite-kafka-topic

percentageOverThreshold: 100000

avgValueCrossingThreshold: 256686.56666666668

maxValuesCrossingThreshold: 273866

minValuesCrossingThreshold: 242031


Otherwize, I'm trying to get the first value of 
{{_payload.alert_value}} (it's looks like a list) but I have an error when I try 

"{{_payload.alert_value[0].avgValueCrossingThreshold}}" or "{{_payload.alert_value.get(0).avgValueCrossingThreshold}}"

I read the doc here but I don't find the information about it.

Thanks :) 

 

1 answer

0 votes
Arumugam M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 26, 2024

Hey @Tifenn Le Goff ,

Thank you for reaching out with your question.

Upon examining the object/data, it appears to be a map consisting of key-value pairs within an array.

Unfortunately, there isn't a simple function to directly retrieve values from such data, as accessing array methods tends to convert the data to a string format automatically.

To obtain the values you want, you'll need to follow a two-step process.

First, access the first element in your array and assign it to an alert field, like Extra Properties. I've added the following methods to Extra Properties with a key called "topic":

{{_payload.alert_value.get(0)}}

I've attached a screenshot for your reference.

2024-12-26_14-46-11.png

This approach allows you to use Alert Policies to apply string processing methods and extract only the values you're interested in.

Since I've added the entire object to an Extra Property called "topic," you can use the following method to extract the Kafka Topic, based on your example:

{{extraProperties.topic.substringBetween("labels={topic=", "}")}}

2024-12-26_14-48-06.png

You can use similar string methods to access other values you need.

I hope this information is helpful.

Thanks, 

Arumugam

 

Tifenn Le Goff
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!
December 26, 2024

Hey @Arumugam M 
Great! Thanks a lot for your answer, I will try to do it.

Have a great day,

Tifenn

Like Arumugam M likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events