PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.44k stars 1.52k forks source link

Subject and Body of PagerDuty Automation Appear Concatenated in the Incident Title #10427

Open biancaines opened 11 months ago

biancaines commented 11 months ago

First check

Bug summary

When using a PagerDuty block with an automation, the fields for the subject and body of the notification become concatenated and are both present in the title of the incident in PagerDuty. When using the default inputs for an automation (with all flow run metadata) it results in a lengthy incident title, which is difficult to interpret.

The screenshots below show how the subject and body of the notification is set, and how the information is currently presented in PagerDuty.

automation_screenshot pagerduty_prefect_1_top pagerduty_prefect_2_bottom

Ideally, the title should only include the subject provided to the automation. The information in the body would be in the Custom Details section of the incident report. See the examples below for how Datadog notifications are presented in PagerDuty.

pagerduty_datadog_1_top pagerduty_datadog_2_bottom

Reproduction

1. Create a PagerDuty notification block
2. Create an automation which, when triggered, fires off a notification using the block. Enter information into the fields for the subject and body of the notification.
3. Once the automation is triggered, preview the resulting incident report in PagerDuty.

Error

No error provided.

Versions

2.10.11

Additional context

No response

ConstantinoSchillebeeckx commented 5 months ago

I dug into this a bit and this looks to be an issue on the apprise side of things. Executing things directly from apprise with:

# Assuming our {integration_key} is A1BRTD4JD
# Assuming our {api_key} is TIiajkdnlazkcOXrIdevi7F
# Assuming our {source} is node01.local
# Assuming our {component} is drive_sda
apprise -vv -t "Test Message Title" -b "Test Message Body" \
   "pagerduty://A1BRTD4JD@TIiajkdnlazkcOXrIdevi7F/node01.local/drive_sda/"

yields the following PagerDuty incident

image

Notice the title and body are being use to set the description.

The way to work around this for now is to omit a title, and set only the body. The PagerDutyWebHook class does have an argument custom_details in which you can stuff any extra information for the event; however, unfortunately, that doesn't support jinja templating. So you can't put anything dynamic into it. It'd be nice if templating were supported there as this would make notifications much more dynamic.

rphamle commented 2 months ago

I noticed that if I send an alert to PagerDuty using an Automation -> Pager Duty Webhook Block, the message that is generated from the incident on PagerDuty's side looks like an Events V1 payload, rather than an Events V2 payload. Is this expected?

thaparsahil commented 2 months ago

The way to work around this for now is to omit a title, and set only the body.

The subject is not optional though. At least not on the UI