Error Reporting Payload Examples

Hello All,

 

I'm testing the Error Reporting feature by sending a message into MS Teams. Anyone care to share an example of their payload? I feel I have the essentials, but maybe I might be missing something. Here's my example:

 

{

 "title": "Matillion Runtime Error in Job: ${job_name}",

 "text": "Job Name: ${job_name}

  Component Name: ${component_name}

  Component Message: ${component_message}

      Detailed Error: ${detailed_error}"

  

}

This was our basic payload when we started to use the feature:

{

"title": "Failed Matillion Job in Project ${project_name}",

"subtitle": "Job Name: ${job_name}",

"text": "

*Component Name:* ${component_name}

**Component Message:** ${component_message}

*Detailed Error:* ${detailed_error}

"

}

Nowadays we use a more sophisticated layout which produces the following output:

{

"@type": "MessageCard",

"@context": "http://schema.org/extensions",

"themeColor": "0076D7",

"summary": "Failed Matillion Job in Project ${project_name}",

"sections": [{

"activityTitle": "Failed Matillion Job in Project ${project_name}",

"activitySubtitle": "Job Name: ${job_name}",

"activityImage": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Green_bug.svg/200px-Green_bug.svg.png",

"facts": [{

"name": "Component Name",

"value": "${component_name}"

}, {

"name": "Component Message",

"value": "${component_message}"

}, {

"name": "Detailed Error",

"value": "${detailed_error}"

}],

"markdown": false

}]

}

Hi @Michael​ .

I've been trying ​to handle the error message using webhook post component refer to this topic.

In my case, I would like to post message to slack, not MS Teams.

This is my webhook payload templates below.

{

"text": "

*Error:* Failed Matillion Job at the project below.

*Project Name:* ${project_name}

*Job Name:* ${job_name}

*Component Name:* ${component_name}

*Component Message:* ${component_message}

*Detailed Error:* ${detailed_error}

"

}

Then, I put webhook post component on the canvas like this.

What I would like to do is that if the Sharding Retry component was failed, webhook post component will get error detail and post it to slack channel.

But when I run this job, variables were not substituted.

One thing that I tried was define environment variables, but the result was not changed.

I think I don’t need to define variables like ‘component_name’, ‘job_name’ and things like these because it has already defined by Matillion originally, but should I define again or do something??

Thank you.

Dear @Michael

Thank you for your prompt reply.

​As you said, it was successful when I write like "{{component_name}}" on Manage Webhook Payloads template.

In addition, I understand that If I don't define template and use custom at property, I could write "${component_name}" and it was successful.

Thank you for your explanation and I hope it's gonna be useful for all Matillion user.

This is absolutely above and beyond anything I was doing. Thanks so much for this!!

I think the magic is to escape the variables correctly. For unknown reasons, Matillion apparently decided to design both the "Manage Error Reporting" and the "Webhook component in a different way.

My example works for the "Manage Error Reporting" feature. If you use the Webhook, try to escape variables as follows:

 

"value": "{{load_error}}"

 

You don't have to re-define environment variables.

Dear @Michael

There is an additional problem about webhook component, so I'm glad if you know how to solve this problem,.

First, I could handle error report as I wrote previous post.

Then, I would like to define it as a Shared Jobs because I don't want to define on each job.

This is my webhook payloads template named error_report.json below.

{

"blocks": [

{

"type": "header",

"text": {

"type": "plain_text",

"text": ":warning: Matillion Runtime Error in Job: {{job_name}} :warning:"

}

},

{

"type": "divider",

"block_id": "divider1"

},

{

"type": "section",

"text": {

"type": "mrkdwn",

"text": "*Project group:* {{project_group_name}} \n *Project:* {{project_name}} \n *Job name:* {{job_name}} \n *Full error message:* \n {{detailed_error}}"

}

},

{

"type": "actions",

"elements": [

{

"type": "button",

"text": {

"type": "plain_text",

"text": "Open Project"

},

"url": "{{url}}"

}

]

}

]

}

Then, this is some orchestration in order to create Shared Jobs.

After I define it as a Shared Jobs, I use it on orchestration job like this.(Sharding Retry component is gonna be failure)

As a result, there is a notification to my slack channel, but ‘job_name’ is equal to shared job’s component name like this.

I could get 'detailed error' but I can't get 'job_name' , so if someone know how to get 'job_name'(not shared jobs component name), please let me know.

Thank you.

​Dear Michael

Thank you for your reply and explanation in detail.

Thanks to your advise, It was successful and this is what I wanted to do!!

I really appreciate it and hope it will useful for other Matillion user.

Thanks Michael!

 

What I am doing is to add variables to the Payload Template, like "job_name": "{{job_name}}" and then define the Payload Variable job_name as $(job_name).

 

I guess there is not easier way of doing this, right?

 

Hopefully Matillion sort this out at some point.

Yes, I guess that's currently the best way to go...

I think you can't use $[job_name} directly in the shared job as this variable will always point to the currently running job (which is the shared job in this case).

 

Try to add a public variable to the shared job and call it "my_job_name". Then, from the job where you have "Sharding Retry", assign "my_job_name" the value ${job_name}. This should pass the name of the outer job to the inner (shared) job.