Datadog tag journey into Statuspage incident through Opsgenie extra properties

Daniel F
Contributor
November 12, 2022

Hi everyone,

 

I am facing a challenge how to get a datadog alert update a component´s status in Statuspage through Opsgenie. Sorry for the long post, I´ll do my best to describe the issue:

 

We have a monitor in Datadog that sends an alert with the tag "service:ServiceName" (datadog does not allow spaces in tags). We get this tag and turn into an extra property in Opsgenie but it´s still in a format of "ServiceName", instead of "Service name". If we want to trigger a new Statuspage incident from this Opsgenie alert, we would need to turn this into an Opsgenie tag like: comp_Service name:partial outage (as an example). This tag will trigger a new incident and component´s status update on Statuspage, so this should be the outcome.

 

Now, I am struggling with 2 steps.

 

1. How can I convert "ServiceName" into "Service name" as extra property that I can use as variable later on. "Service name" is the component name in Statuspage, so I need to format this extra property into the format of Statuspage component, so with spaces and not as one word. 

2. How can I create custom extra property by combining other extra properties? Example: 

new extra property with the name "statuspagefinaltag" : comp_{{service}}:{{compstatus}}

I have created a global policy to create service and compstatus extra properties (based on priority and the service name) but when I try to use them as variables to create this new statuspagefinaltag extra property, it does not work.

 

I am curious if someone has any idea how to deal with this and thank you for your suggestions in advance!

1 answer

1 accepted

1 vote
Answer accepted
John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 14, 2022

Hi Daniel,

You shouldn't need to use extra properties or policies in this case - you can simply parse your Datadog tags directly into Opsgenie tags, which will trigger the Statuspage component update.

In the advanced settings of the Datadog integration, you would need to add the following string-processing/regex expression to the tags field:

cmp_{{dd_tags.extract(/([A-Z]\S+)([A-Z]\S+)/, 1)}} {{dd_tags.extract(/([A-Z]\S+)([A-Z]\S+)/, 2)}}:partial_outage

As long as the format of all of your services is two words, with both beginning with capital letters - like 'ServiceName', that expression should work.

Daniel F
Contributor
November 15, 2022

Hi @John M ,

 

Thank you for your support and the amazing suggestion. I get the 2 words separately now, which is a huge improvement, but I need to check how to get rid of the comma sign right after the second word. Datadog sends the tags like this: service:ServiceName, geo:emea, env:prod, - so there is always a comma between the tags and in my case, I get a  comp_Service Name,:partial_outage value. 

 

Sometimes I have service names with 3-4 words, do you know how to parse them?

 

Thank you for your help in advance!

John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 15, 2022

Hi @Daniel F ,

With the service name being a variable number of words, the problem becomes more difficult. For example, the below regex will add spaces between as many as 5 words (with each new word starting with an uppercase letter) but the issue is that if there are fewer than 5 words, there will be a space before ":partial_outage", which will not work for the status page integration. 

{{dd_tags.extract(/(?<=service\:)([A-Z][a-z]+)/, 1)}} {{dd_tags.extract(/(?<=service\:)([A-Z][a-z]+)([A-Z][a-z]+)/, 2)}} {{dd_tags.extract(/(?<=service\:)([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)/, 3)}} {{dd_tags.extract(/(?<=service\:)([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)/, 4)}} {{dd_tags.extract(/(?<=service\:)([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)/, 5)}}

So, to make this work, we will need to use alert policies to get rid of the last space. First, you will need to add the above regex to the Extra Properties fields in the Datadog integration, with a key of "service" (or whatever you want to call it).

2022-11-15_11-49-29.png

The next step would be to set up a global policy that looks for Datadog alerts, gets the extra property for "service" and then parses it into the tags fields, wrapped in the required Statuspage tags. 

2022-11-15_11-13-08.png

2022-11-15_11-49-58.png

The other option would be to change your Statuspage service names to remove the spaces and you could use a simpler regex directly in the tags field of the Datadog integration, like the one below

cmp_{{ dd_tags.substringBetween("service:",",") }}:partial_outage

Like Steffen Opel _Utoolity_ likes this
Daniel F
Contributor
November 15, 2022

Well @John M , this is beyond the best support I have ever seen! I really appreciate your help and amazing suggestions. It worked with the regex and the global policy to create to correct tag. I was really unsure if we could automatize this statuspage tag creation and I started mentally preparing myself to create 25-30 global policies and test each single one of them, so a huge THANK YOU from my whole team!

Like # people like this
John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 15, 2022

I'm glad I could help!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events