cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Update Ingestion pipleline to use pager duty with API

turagittech
Contributor II

Hi,

I have been working to update a cdc ingestion pipeline to add a notification to it on failure. We have had two instances where a maintenance task by vendor as tripped up CDC with some grief.

I reviewed all the information and I am getting an error

 

 

{"notifications": [
    {
      "destination_id": ["UUID"],
      "alerts": [
        "on-update-failure",
        "on-update-fatal-failure",
        "on-flow-failure"
      ]
    }
  ]
 }

I had a look at this and it provides an error "message": "`gateway_definition` must be set.",
Add it in this fashion

{
  "gateway_definition": {
      "connection_name": "connection_name",
      "gateway_storage_catalog": "catalogname",
      "gateway_storage_schema": "default",
      "source_type": "databasetype"
  }
  ,"notifications": [
    {
      "destination_id": ["UUID"],
      "alerts": [
        "on-update-failure",
        "on-update-fatal-failure",
        "on-flow-failure"
      ]
    }
  ]
 }

 and then I get errors like "message": "Specified 'schema' field in the pipeline settings is illegal. 

I reviewed this discussion

Anyone been able to do this

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Mateus-Moreira
New Contributor II

Hi! I think the errors come from how the update is sent, not from the notification block itself.

1. PUT /api/2.0/pipelines/{id} replaces the whole spec, it doesnโ€™t merge. Thatโ€™s why it asks for gateway_definition. The 'schema' field is illegal error usually means a top-level schema/target/catalog ended up in the payload, and gateway pipelines donโ€™t accept those. The safest way is to fetch the current spec, add only the notifications and send it back complete:

 
bash
databricks pipelines get <pipeline_id> | jq '.spec' > spec.json

jq '.notifications = [{
      "email_recipients": ["team@company.com"],
      "alerts": ["on-update-failure","on-update-fatal-failure","on-flow-failure"]
    }]' spec.json > spec_new.json

databricks pipelines update <pipeline_id> --json @spec_new.json

If the schema error still shows up, check spec_new.json for a leftover top-level schema/target and remove it. Keep everything inside gateway_definition as is.

2. As far as I know, destination_id isnโ€™t supported in pipeline notifications. They only take email_recipients + alerts. Notification destinations (Slack, Teams, webhooks) are a Jobs feature. If you need one of those, run the pipeline as a pipeline task in a Job and set:

 
json
"webhook_notifications": { "on_failure": [{ "id": "<destination-UUID>" }] }

3. Decide which pipeline should alert. Lakeflow Connect has two: the gateway (continuous, reads CDC from the source) and the ingestion pipeline. Vendor maintenance on the source DB usually breaks the gateway first, so Iโ€™d add alerts to both.

4. UI alternative: depending on your workspace version, you can add email notifications in Pipeline โ†’ Settings โ†’ Notifications without touching the API.

Hope this helps!

Mateus Moreira | Data Analyst Engineer

View solution in original post

3 REPLIES 3

Mateus-Moreira
New Contributor II

Hi! I think the errors come from how the update is sent, not from the notification block itself.

1. PUT /api/2.0/pipelines/{id} replaces the whole spec, it doesnโ€™t merge. Thatโ€™s why it asks for gateway_definition. The 'schema' field is illegal error usually means a top-level schema/target/catalog ended up in the payload, and gateway pipelines donโ€™t accept those. The safest way is to fetch the current spec, add only the notifications and send it back complete:

 
bash
databricks pipelines get <pipeline_id> | jq '.spec' > spec.json

jq '.notifications = [{
      "email_recipients": ["team@company.com"],
      "alerts": ["on-update-failure","on-update-fatal-failure","on-flow-failure"]
    }]' spec.json > spec_new.json

databricks pipelines update <pipeline_id> --json @spec_new.json

If the schema error still shows up, check spec_new.json for a leftover top-level schema/target and remove it. Keep everything inside gateway_definition as is.

2. As far as I know, destination_id isnโ€™t supported in pipeline notifications. They only take email_recipients + alerts. Notification destinations (Slack, Teams, webhooks) are a Jobs feature. If you need one of those, run the pipeline as a pipeline task in a Job and set:

 
json
"webhook_notifications": { "on_failure": [{ "id": "<destination-UUID>" }] }

3. Decide which pipeline should alert. Lakeflow Connect has two: the gateway (continuous, reads CDC from the source) and the ingestion pipeline. Vendor maintenance on the source DB usually breaks the gateway first, so Iโ€™d add alerts to both.

4. UI alternative: depending on your workspace version, you can add email notifications in Pipeline โ†’ Settings โ†’ Notifications without touching the API.

Hope this helps!

Mateus Moreira | Data Analyst Engineer

turagittech
Contributor II

Agree with 3 and we have had far too much experience with issues from that and the latest is why I am beefing up notifications. PagerDuty has an email configured for the service, so maybe that one has to go via email.

My UI tends to be up to date, and I don't see the ability to change it in UI for the ingestion pipeline. Gateway had it an it is now hooked to PagerDuty, as that works. Why the other isn't accessible is a mystery

Note to Databricks: add notification destinations to all pipelines and make it easy to deploy both via API or via UI. Update your bundle definition documents to show a good example to finish it off. 

AbhilashNagilla
Databricks Employee
Databricks Employee

Hi @turagittech, a pipeline's [notifications](https://docs.databricks.com/api/pipelines/v2/edit) setting accepts only email_recipients and alerts, while notification destinations such as PagerDuty are added in a job's notification settings.

  1. For the ingestion pipeline, add the destination to the job that schedules it (adding a schedule creates that job). [POST /api/2.2/jobs/update](https://docs.databricks.com/api/jobs/v2/update-job) replaces only the top-level fields in new_settings, so include any destinations already in the job's webhook_notifications:

     {
       "job_id": <scheduling-job-id>,
       "new_settings": {
         "webhook_notifications": {
           "on_failure": [{"id": "<destination-id>"}]
         }
       }
     }
  2. For the gateway, which runs continuously, add a PagerDuty email integration entry to its notifications list:

     {
       "email_recipients": ["<pagerduty-integration-email>"],
       "alerts": ["on-update-failure", "on-update-fatal-failure", "on-flow-failure"]
     }

    [PUT /api/2.0/pipelines/{pipeline_id}](https://docs.databricks.com/api/pipelines/v2/edit) takes the pipeline's settings as its body, so add the entry to the spec returned by GET /api/2.0/pipelines/{pipeline_id} and send the whole spec back with its other fields unchanged. A continuous pipeline restarts with the updated configuration, so update the gateway when a restart is acceptable.