i have an alert for which i want to basically append the service name at the end of the title when it send notifications to jira(opsgenie)
sharing the complete payload at the end..
i want the value of "metric.labels.destination_service_name" to show dynamically in the description or title
eg.
metric.labels.destination_service_name = \\\"mp-customer-catalog-api\\\"\"
currently i am able to access the below string from _payload json as
payload: resource.type = "k8s_pod" AND metric.type = "istio.io/service/client/request_count" AND metric.labels.destination_service_name = "mp-customer-catalog-api"
but since jira doesnt support regex directly in the alert rules i am not able to extract the value of metric.labels.destination_service_name which is "mp-customer-catalog-api"
when i am setting
payload: {{_payload.incident.condition.conditionThreshold.filter}}
in the alert rule of integration (create alert)
this is the full payload
{"_incomingData":{"integrationType":"GoogleStackdriver","_payload":"(len:2188) {\n \"incident\": {\n \"condition\": {\n \"conditionThreshold\": {\n \"aggregations\": [\n {\n \"alignmentPeriod\": \"60s\",\n \"crossSeriesReducer\": \"REDUCE_SUM\",\n \"groupByFields\": [\n \"metric.label.destination_service_name\"\n ],\n \"perSeriesAligner\": \"ALIGN_RATE\"\n }\n ],\n \"comparison\": \"COMPARISON_GT\",\n \"duration\": \"60s\",\n \"filter\": \"resource.type = \\\"k8s_pod\\\" AND metric.type = \\\"istio.io/service/client/request_count\\\" AND metric.labels.destination_service_name = \\\"mp-customer-catalog-api\\\"\",\n \"thresholdValue\": 1400,\n \"trigger\": {\n \"count\": 1\n }\n },\n \"displayName\": \"TEST COM Gateway to Client 503 - \",\n \"name\": \"projects/noonprd-mp/alertPolicies/17127010963740233260/conditions/16826668787060541546\"\n },\n \"condition_name\": \"TEST COM Gateway to Client 503 - \",\n \"ended_at\": null,\n \"incident_id\": \"0.nt3l0e7hjlet\",\n \"metadata\": {\n \"system_labels\": {},\n \"user_labels\": {}\n },\n \"metric\": {\n \"displayName\": \"Client Request Count\",\n \"labels\": {},\n \"type\": \"istio.io/service/client/request_count\"\n },\n \"observed_value\": \"1743.717\",\n \"policy_name\": \"[mp-devops] TEST COM Gateway to Client 503 - \",\n \"policy_user_labels\": {\n \"created_via\": \"pulumi\",\n \"squad_code\": \"tech_noon_devops\"\n },\n \"resource\": {\n \"labels\": {\n \"project_id\": \"noonprd-mp\"\n },\n \"type\": \"k8s_pod\"\n },\n \"resource_id\": \"\",\n \"resource_name\": \"noonprd-mp Kubernetes Pod labels {project_id=noonprd-mp}\",\n \"resource_type_display_name\": \"Kubernetes Pod\",\n \"scoping_project_id\": \"noonprd-mp\",\n \"scoping_project_number\": 497356379434,\n \"severity\": \"No severity\",\n \"started_at\": 1748851104,\n \"state\": \"open\",\n \"summary\": \"Client Request Count for noonprd-mp Kubernetes Pod labels {project_id=noonprd-mp} is above the threshold of 1400.000 with a value","_httpParams":{"apiKey":"..."},"httpUrl":"/v1/json/googlestackdriver","teamId":"16750cfd-2530-4ee0-8c50-60f1a67f9925","incomingDataId":"98bcb990-76a0-41f0-b2c7-434ae978d350","_httpHeaders":{"User-Agent":"Google-Alerts","X-Amz-Cf-Id":"ZX-UquP73UP9bsfn_OLtPffUzzG-g0yQ5wgxvQVEGC-MgoRkBRxEPg==","X-Forwarded-For":"142.250.32.40, 10.20.17.243, 10.255.0.13, 10.18.116.51","Accept-Encoding":"gzip, deflate, br","Content-Length":"2188","X-Amzn-Trace-Id":"Self=1-683d59a0-292b07c872393bd95a63cbb3;Root=1-683d59a0-359276d94cf4a9d708a28379","Content-Type":"application/json"}}}
Hi @Mohd Aamir Mir Welcome to the Atlassian Community
Have you considered extracting the valuable information of the payload by means of smart value operations on texts provided by Atlassian?
You can use indexOf(String str) to locate the key-value pair you're interested in.
Then use substring(int start, int end) or one of the other substring commands to get the value you're after.
Kind regards,
Dick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.