Pagerduty API - services and empty scheduled_actions

Hello,

We have been trying to setup our pagerduty configuration using Terraform and have discovered a ‘quirk’ of the API that I would like to have resolved (if possible) - the details of the issue can be seen here (Terraform Pagerduty Provider Issue - Github) but I think this is ultimately an API issue.

At a high level, when creating services via the API, there is a strange setup where “Support Hours” based services require a “scheduled action” entry in the request that is empty. This occurs when a service uses the severity based urgency. I would like to have the API updated, to not require this field when it is not required - e.g. why do I have to send an empty array into the API. This needlessly complicates the API.

Here is an excerpt of a request that has this issue:

"incident_urgency_rule": {
    "type": "use_support_hours",
    "during_support_hours": {
      "type": "constant",
      "urgency": "high"
    },
    "outside_support_hours": {
      "type": "constant",
      "urgency": "severity_based"
    }
},
"scheduled_actions": [],
"support_hours": {
  "type": "fixed_time_per_day",
  "time_zone": "Canada/Toronto",
  "days_of_week": [
    1,
    2,
    3,
    4,
    5
  ],
  "start_time": "09:00:00",
  "end_time": "17:00:00"
},

Would like to request that where I want to use a severity_based urgency rule with a support hours based service, that the scheduled_actions empty array not be required.

Thanks.

Hi @noakes,

The API docs indicates the scheduled_actions is used for the option:

Raise urgency of all triggered incidents for this service to High when service support hours begin

I think if you’re not including this you will end up misclassifying issues which came in with a lower severity outside of support hours because they’ll remain at low urgency. I strongly recommend this for anyone who is configuring support hours.

It’s not my place to say how the API should be implemented, however, and this was just a side note about not using the option.

Cheers,
Simon

Hey - agree, except that if you use ‘severity based’ alerting alongside business hours setup, this option does not exist.

Through the UI, this is the equivalent of setting up a service using “Use defined support hours” and then selecting “Notify based on alert severity” either during or outside of defined hours. In that case, the checkbox that sets up a ‘scheduled action’ does not show up and if you look at the service definition through the API, it is an empty array.

I completely understand why it is not there as it logically doesn’t make sense to both use severity based alerting AND have alerts either escalate at the inflection between support hours and outside support hours. My real issue is that the implementation of the API in this case (having an empty array/list for this field in the situation) makes for an ugly implementation on the client side where we are trying to setup the services (and modify them) programmatically - why not just allow it not to be specified at all (which has the same ultimate result).

There isn’t really a solution to this issue - just this was the best place for me to provide feedback and put in what I would consider a feature request for the API.

Thanks.

Oh, I hadn’t realised that. Sounds like another bug - feels like you should still be able to raise the urgency back to high during daytime hours, even if you had severity-based alerting overnight…

There isn’t really a solution to this issue

Sure there is! Feature request for PagerDuty and then it gets fixed (marked optional in the API). :slight_smile: