Free Trial Book a Demo

Uncover the Logic Apps Business Exceptions Using Serverless360 BAM

Arunprabhu Muthusamy

6 Mins Read | Last modified on August 18th, 2023

Uncover the Logic Apps business exceptions using Serverless360 BAM

Introduction

How many times do you check “Where is the message?” This could be an order, a product update, an event about some interesting change in a system. Whatever may be the context to the business users, some business transactions are executed and they are unsure where the transaction is up to and if there is any problem. This situation can be a burden on an IT department.

Business Activity Monitoring (BAM) is a way to provide a simplified business-focused view on what might be a complex underlying system or group of system interactions that execute to fulfill the business transaction.

If you have an end-to-end distributed tracing solution, then you can significantly simplify the ability to support these business transactions.

You can make it easy for your support team to get to the issue quickly, you can recover from issues faster and you can even allow business users to participate in answering their questions like “Where is my order”?

This blog is intended specially to explain the process to uncover the Logic App exceptions using the Serveless360 BAM feature. You might be facing exceptions in the Logic Apps like invalid id, invalid message format exception, and more.

Unfortunately, in the Azure portal, you cannot track end to end data flowing through Logic Apps without complex instrumentation and sending over the exception logs to Azure Log Analytics for better visualization and diagnostics. It certainly requires a level of experience to set the initial custom tracking using the native Logic App actions.

In case of any discrepancy in the custom tracking then it would be certainly hard for people with less experience to fix/handle it. But, Serverless360 BAM comes very handy and provides a similar experience like a native connector with much more exception details that can be captured.

Now let us dive in and check out how to discover the business exceptions in your Azure Logic Apps.

Scenario

Azure Logic App exceptions

The above is the Cab booking application built with the Azure Serverless services. Consider a developer, who wants to log all the exceptions in a business process in a single place. They should also get informed about the exceptions in the business transaction along with the reason behind the failure to debug the problem. DevOps engineers will also need to have analytics features to monitor the performance of business transactions.

Through BAM in Serverless360, users can log, analyze, and monitor the exceptions from the business processes.

Tracking Exception Details in Transactions

The exceptions could pop up at any instance and stage due to invalid data, system errors, or user errors. Consider the above-mentioned Cab Booking application, there would be a need to track the Driver Id, User Id, and Location which could cause exceptions. By configuring the necessary properties while creating the business process, this can be tracked in the BAM section.

User can even archive the whole messages and their header at each stage. Along with the tracked properties, it is also possible to know the status of each stage and the transaction.

The best part with Serverless360 is the ease of use which also helps the support person to easily make the necessary changes to the transaction and reprocess it.

Tracking Exception Details

Logic App Exception Handling

Tracking Exception can be done on different Azure resources like Azure logic apps, Functions Apps.

To track exceptions in Azure Logic Apps, the user needs to deploy the BAM custom connector into the user location where the logic app is available.

Once the connector is deployed, the user can handle the exceptions in the Logic App by providing the necessary information into the BAM connector as below

Logic App Exception Handling

When the user wants to track the exceptions in resources like Azure Functions, Worker role, and Web job, they can use the exposed BAM APIs.

By sending the exception details to the APIs secured with API Key, the user can track the exceptions as shown in the above image.

Use the try-catch along with the checkpoint library to track the exception that is occurred in the code as shown below

using Kovai.Serverless360.Bam;
using Newtonsoft.Json;

namespace Kovai.Serverless360.Sample
{
  public class OrderProcessor
  {
    private readonly ITransactionService _service;
    private readonly string _businessProcess;

    public OrderProcessor(ITransactionService service)
    {
      _service = service;
      _businessProcess = "BookingProcessor";
    }

    public void ProcessBookings()
    {
      var businessTransaction = "Details Validator";
      string messageBody = "{\"userId\":1,\"Location\":\"PR01\",\"driverId\":1 }";

      var startTransactionResponse = _service.StartTransaction(new StartTransactionRequest
      {
        BusinessProcess = _businessProcess,
        Transaction = businessTransaction,
        Stage = "Get Booking",
        MessageBody = messageBody,
        MessageHeader = "{\"source\":\"website\"}",
        StageStatus = StageStatus.Success
      }).Result;
        _service.CheckPoint(new CheckPointRequest()
        {
          Stage = "Decline Booking",
          TransactionInstanceId = startTransactionResponse.TransactionInstanceId,
          StageStatus = StageStatus.Failure,
          MessageBody = messageBody,
          MessageHeader = "{\"source\":\"website\"}",
          ExceptionCode = "500",
          ExceptionMessage = "Invalid Id",
          IsTransactionComplete = true
        }).GetAwaiter().GetResult();
      }
  }
}

Logic App Exception Handling with Serverless360

Exception Monitoring

BAM allows the users to log exceptions along with exception code at each stage of the business transaction. The logged exceptions will be displayed to the users on selecting the transaction instance. Users will also expect alerts immediately whenever an exception gets logged in any of the stages of the transactions. The exception monitor in Serverless360 comes to serve this purpose.

Analyzing the Exceptions

Consider a business development manager who would need to track the business trends at various locations or the number of bookings in the last 30 days to make strategic business decisions like expanding business. With the help of the Serverless360 dashboard, the user can see the visualization of the data as graphs.

Analyzing Logic App Exception

Conclusion

This blog explains about the Business Activity Monitoring feature in Serverless360 and how it helps to keep track of any exception in your Logic Apps while eliminating complex instrumentation to the custom tracking.

Furthermore, we have seen how to track the exception details in the Logic Apps and eventually do the monitoring on the known exceptions for the support team to be more proactive. Also, we have seen how managers could leverage the analytics feature to see the trend in the exceptions over a period.

Finally, BAM in Serverless360 solves huge challenges in end-to-end message tracking through the business process and the need for analytics. It reduces the Total Cost of Ownership and reduces the effort spent on building a solution to do end-to-end trackability by 20%.

This article was originally published on Aug 26, 2020. It was most recently updated on August 18th, 2023.

Azure Logic App - Request Demo CTA
Need a better Azure Management platform?

Serverless360 helps to streamline Azure monitoring, distributed tracing, documentation and optimize cost.

Sign up Now