We're receiving alerts from GCP through the standard webhook integration.
The payload looks like this:
{
"incident": {
...
"metric": {
"labels": {
"metric_label": "value"
}
}
"policy_user_labels": {
"policy_label": "value"
}
}
}
I want to automatically turn these labels (at least the policy ones) into alert tags. Is there a way to do so?
The "{{_payload.customField}}" syntax for alert properties doesn't seem to support nested fields.
Hello @Konstantin Likhomanov
According to docs it works: https://support.atlassian.com/jira-service-management-cloud/docs/work-with-dynamic-properties/
When I tried to add via + button more then one nested files got same validation error.
But if you add value to Description or tags without adding to Alert properties via "+" button it actually works.
Example:
Started At : {{started_at.toDate()}}
Incident Url : {{url}}
Summary: {{summary}}
Alert Documentation:
{{_payload.incident.documentation.content}}
gcp_policy_name: {{policy_name}}
for tags field gcp labels are under: {{_payload.incident.policy_user_labels.my_awesome_label}}
So nested works when you just use it without adding to Alert properties
Welcome to the Atlassian Community!
The {{_payload.customField}}
syntax in Opsgenie’s alert field mappings does not support accessing deeply nested fields like out-of-the-box.
One possible workaround would be to use GCP's alerting system to send webhooks to an intermediate Cloud Function that would:
Extract incident.policy_user_labels
Format them as a list of tags (e.g., ["policy_label:value"]
)
Send to Opsgenie with those as the tags
field directly.
Hope this suggested approach helps.
Best Regards,
Eugenio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.