Wednesday, November 20, 2024

#1043 - OIC Integration Flow Error Raising the Alarm

Simple requirement here - send me an email as soon as integration NN fails.

Here is my integration - 

I've done the saveOrder Map so as to ensure an error is thrown on the Netsuite invoke.

I now go to the OCI Service Metrics for my OIC instance - 

Go to Failed Messages - click on View query in Metrics Explorer -

We will edit the query to only show errors from the integration - ProcessOrder4Netsuite




Now to the Metric Dimensions -


The default entry specifies the OIC instance. Click on Additional Dimensions so we can narrow the query down to just our integration -  

flowCode identifies the integration - 

I execute the integration two more times, throwing 2 more errors -

Looks good - now to creating the alarm - 

I need to add a name - 

Now to the trigger rule - here is the default rules generated, which I need to edit.


Now to the Destination of the Alarm - 

A Topic needs to be defined - 
Click on Create a topic -

Note the various Subscription protocols supported - I select Email.


I click Create topic and subscription and then Save alarm.

I immediately receive an email asking me to confirm my subscription; this I do.

I now run the integration again - 

I check out the Alarm definition - 

The alarm has fired, so I check my email -

10 minutes later I receive an email telling me the alarm has been reset - 


I can only specify one email for the notification topic, so, if I need more, I'd need to use a DL.

Error Notification via a scheduled job


Another approach is to create a scheduled job, which uses the OIC Factory api to check for errors in my integration. 

The api call I use is as follows - https://design.integration.us-phoenix-1.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/errors?integrationInstance=myInstance&q={timewindow: '1h', projectCode: 'AA_OIC_BASICS'}

Here is my project - 

I test the api in Postman and check the data returned -


As you can see, this contains lots of salient info. 

I create a REST connection for the Factory API  and use it in my scheduled integration -

The integration flow is simple - 

So let's go through the steps - 

NotifyStart: just sends an email to interested parties informing them the integration has started.

AssignVars: creates a couple of useful variables.

Invoke GetErroredInstances: is configured as follows - 




I use the Postman response as the example response here - 
The mapping of the query parameter, q, is as follows - 
concat ("{timewindow:", "'", $param_timeWindow, "'", ",", "projectCode:", "'", $param_project, "'", ",", "code:", "'", $param_integration, "'", "}" )

As you see, I've defined a couple of integration parameters here - 



The invoke of getErroredInstances can return an array of errored instances, which I can then process in a For-Each loop - 

I write the error details to a temporary file (append mode) of type csv -

You can see the fields I am mapping - 

I can inform the admin(s), once all errors have been processed -

The Stage file action, ListErrorFiles, gives me a handle to the .csv file.

I then add this reference as an attachment to the email - 

I run the scheduled integration - 

I open the csv in excel - 

Naturally, we can prettify this, but I hope you can extrapolate from what I've discussed here.








 













































 

No comments: