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

Get value from a list of datadog tags using advanced integration fields

Bart Scheltinga June 11, 2021

Hi all!

My monitoring tool send a bunch of tags which is encapsulated in the field {{dd_tags}}.

For example it sends: 

"Datadog Tags": "Service:Appname, Team:Teamname" (tags found log)

When I use {{dd_tags}} in the advanced integration, it shows all the tags and values beautiful in the alert. But I want to have the value of a certain tag as a field (extra propertie), so I can use it for other things.

For example, add the property "Service" and put "Appname" as a value for that property.

But it can't find a way to do that. {{dd_tags}} works for a field, but when I try other things, like:

{{dd_tags.service}}
{{dd_tags.SERVICE}}
{{dd_tags.extract(/service: (\S+)/) }}
{{dd_tags.get(0)}}
{{dd_tags[0]}}
{{dd_tags.substring(5,20)}}

none of this works. What am I doing wrong?

dd_tags.png

 

https://docs.opsgenie.com/v1.0/docs/datadog-integration

So I want these tags as separate properties:

2021-06-11 12_01_33-Datadog Integration.png

 

 

 

1 answer

1 accepted

1 vote
Answer accepted
Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2021

Hi @Bart Scheltinga ,

With the tag you shared above, Team:MVP , I believe you can use string processing or regex to extract the MVP value into an extra property:

https://support.atlassian.com/opsgenie/docs/string-processing-methods-in-opsgenie-integrations/

https://support.atlassian.com/opsgenie/docs/regular-expressions-for-improved-alert-filtering/

You might want to try testing with a few like:

  • {{ dd_tags.substringBetween("Team:",",") }}
  • {{ _payload.dd_tags.substringBetween("Team:",",") }}
  • {{ dd_tags.extract(/Team:(\S+)/) }}
  • {{ _payload.dd_tags.extract(/Team:(\S+)/) }}

 

Hope this helps! Let us know if any other these work.

Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2021

For context as well - I did some testing on a Jira integration (since I do not have a DD instance) - but used some similar tags.

tagscomm1.jpg

The issue with using something like {{dd_tags.get(0)}} - will only pull the first tag in the list alphabetically. So there might be inconsistency using the .get since this could change.

For example with 1 and 2 above - those pull the first two labels that are listed in the payload alphabetically:

tagscomm2.jpgtagscomm3.jpg

 

So string processing and regex might be better options. For example with numbers 3, 4 and 5 in my first screenshot, those pulled these values:

tagscomm4.jpg

 

Some of the other examples you shared:

{{dd_tags.service}}
{{dd_tags.SERVICE}}

^ I don't believe these would work since the tags are parsed as lists, and these would be used more for arrays.


{{dd_tags.extract(/service: (\S+)/) }}

^ You might be misspelling service, have some case-sensitivity issue, or adding an extra space after service:

 

Again, hope this helps with troubleshooting! Let us know if you run into any other questions, issues, etc.

Like Yener Azis likes this
Bart Scheltinga June 16, 2021

Thanks so much for you extensive answer @Nick H 

I'm not sure why it was not working in the first place, I thought I tried all of the possible options. Maybe Atlassian was having a bad day. or it was the case sensitivity. But the good news is, it is working now! ;-)

{{ dd_tags.substringBetween("Service:",",") }} <- Did the trick!

Like Nick H likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events