Distributed Tracing with Serverless360 BAM | Serverless360

Madhavan kovai
15 min readMar 24, 2022

--

Distributed Tracing of a Business Flow

What is the need of tracking a business orchestration?

In a real-time business scenario, various Azure services get integrated to define a business process. Day by day, these business processes grow in complexity, and tracking them turns out to be a real challenge. It is necessary to monitor the business transactions or business flows via the Hybrid business application to ensure business continuity. The factors that can get tracked are the time taken for each step in a business transaction, the status of each stage, whether it is a success or failure, and the business data that flows through the application. The transactions happening in a business organization may fail due to any of the following reasons

  • Incorrect or invalid data
  • Unavailability of resources to process the data
  • Business logical errors

The transactions failing due to any of the above reasons can be easily found if tracked and monitored simultaneously. If such tracking happens, we can quickly diagnose the cause of failure and fix them.

Let us take the booking scenario of a Cab Booking System backed with the Azure Serverless services and see how the Business Activity Monitoring in Serverless360 will help detect the exceptions and track the custom properties of the messages flowing through the business process.

Scenario

The above is the Cab booking application built with the Azure Serverless services. In this scenario, the user submits a new booking request through the exposed web application. The booking request gets submitted as a message to the Service Bus Queue. Then, a Logic App listens to the Service Bus Queue for processing the incoming bookings. Once all the processing gets done, the message is pushed into Service Bus Topic with the label “confirmed “or “rejected”. These bookings further move to a Function App where it accesses the telematic information to decide on booking confirmation and reverted to Logic App after confirmation/ rejection. In this scenario, there will be various challenges faced by different stakeholders of the organization.

Challenges faced in the scenario

Consider a business user who needs message tracking through every stage in the above business activity. The user should get informed of any exception in the business transaction and the reason behind the failure. A Business development manager would need to have analytic information on the booking trends at various locations.

Also, in the above scenario, all the Azure services might be independent and decoupled. This challenge will make it very hard to track all the data in a single place. Apart from tracking, business users would also need to:

  • Get notified on failed transactions
  • Reprocess the failed transactions
  • Track generic properties
  • Perform better analysis with tracked data.

To address this challenge, organizations will attempt to build a custom logging solution with web dashboards. However, these solutions often turn out to be premature as it requires enormous time and effort of skilled resources to build enterprise-grade tracking/monitoring solutions.

Serverless360 understands the pain points and developed BAM to help users perform end-to-end distributed tracing on our Serverless Applications.

Distributed Tracing with Serverless360 BAM

The organization needs to build an end-to-end distributed tracing solution that business users can use in any integration solution. This need is often an afterthought, and the operational support team struggles to run the implemented solution. Sometimes the delivery team will work on a solution. Still, often it is bespoke and challenging to use across projects, and teams spend about 20–30% of their time addressing this challenge, building custom solutions like logging components and web dashboards. The solution will be premature most of the time since building enterprise-grade tracking/monitoring solutions requires enormous effort.

That is precisely the challenge we are tackling in Serverless360 with the BAM feature.

What is BAM?

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 fulfil the business transaction. If you have a BAM solution, you can significantly simplify the ability to support these business transactions.

As we observe the integration scenarios today, they span across boundaries that help us build complex business applications at ease and invites their challenges. The critical challenge being the lack of end-to-end visibility on the message flowing through the business transactions. When a transaction fails, it is hard for business users to understand where the failure occurred and the reason behind the failure. The simplest example could be “Where is the booking confirmation?” in the above Cab Booking Application

Which is the best tool for business activity monitoring?

Serverless360 BAM is an end-to-end distributed tracing solution that can address this challenge by reducing the total effort to instrument the business application to provide end-to-end visibility on the message flowing through various business application services involving Azure entities.

Serverless360 BAM Architecture

One of the critical design decisions in the BAM architecture based on customer feedback was the importance of owning your data and having access to it. As a result, you can configure your own Azure SQL Database and Storage account, where your BAM transactions and messages get pushed.

You will then instrument your components to push BAM events to our BAM service, where you will have a dedicated endpoint that will process your BAM events. We will then push your data to your data components.

At runtime, the Serverless360 portal will access your BAM data when you use our BAM searches and dashboards. The below picture represents this architecture.

Tracking Hybrid Solution with Serverless360 BAM

This section will explore the core concepts and ideology on how BAM works to track a hybrid solution.

BAM Concepts

There are three main terms to understand before exploring the core concepts of BAM. They are,

Business Process — A collection of one or more related business transactions.

Transaction — An operation of the business which represents a set of business activities

Stage — An activity within the transaction. A transaction is a combination of 1 or more stages.

Business Process

Nowadays, we see different integration solutions like on-premises solutions, Azure only solutions, and Hybrid integration solutions. However, irrespective of the integration solutions or technology, they serve as a vital tool for a business process for an organization. Consider an example of a logistics company, Ship Anywhere, which will have many integrations with the carriers. These interactions can be Booking Request, Booking Confirmation, Shipping Instructions, Milestone Status, etc. All these transactions come together and form a Logistics Business Process for Ship Anywhere.

In Serverless360, the business process can get modelled exactly the way depicted in the picture above. Thus, the simplest way to think about a Business Process is that it is a group of Business Transactions.

Transactions

When there is a business process, it would involve several Transactions. A Transaction can be a series of actions or stages.

So, in Serverless360 BAM, the list of transactions involved in this business process can be taken as Business Transactions: Booking Request, Booking Confirmation, Shipping Instructions, Invoice and Milestone Status. Aggregating the transaction and stages are up to customers, and there is no restriction to do it very precisely. In Serverless360, we will implement the transaction like an activity diagram which will be a familiar view to users’ operator and business users.

Implementing BAM

The first step in configuring the business process is to identify the logical grouping of transactions. For example, you may decide to keep all transactions specific to a business unit such as Finance, Supply Chain in their respective business processes or at a more granular level. Once you arrive at a strategy to group the transactions, you will define the business process, related transactions, and stages in the Serverless360 portal.

Let us consider the Order Processing scenario for the implementation. In this scenario, the Order Processing business process has a new order, fulfilling order and ship orders as different transactions.

The transaction is designed into a flow with required stages, as shown in the above picture.

Before configuring the Business process, the user should associate SQL Database and Storage Account to store the BAM related data. To associate both the resources to Serverless360 BAM, the user must provide the credentials mentioned below:

  • SQL Database: Connection string required
  • Storage Account: Either Connection string or Service principal required

Followed by Storage Account configuration, the Business process creation and transaction configuration can be done.

The added advantages during stage configuration are custom properties. Users can use these properties to track the transaction based on a specific property like Order Id or Shipment Id in the above scenario. There are two different kinds of properties BAM supports,

  • Global properties are on a transaction level. They will become visible in the grid; you can update them during a single business process instance and use them across different business processes. Any changes made in the global properties will get reflected in all the stages where these properties get mapped.
  • Stage properties are defined on a stage and more used in a specific scenario in a particular transaction/stage. They will become visible in the Message flow details; they will be stored on every different stage again when used. For example, if the message is an XML message, the user can use the Xpath as Property Source and JSON Path for a JSON message.

The next step is to start instrumenting the technical solution to tell BAM when checkpoints occur in the transactions. Serverless360 BAM provides the following components, which you can plug into your business flow to track the transactions happening in them.

  • Custom connectors for Logic Apps and Microsoft Flow
  • .NET Library for Azure Functions and OnPrem APIs

Connectors

If users are familiar with Azure Logic Apps, they must have used the designer’s view to create their Orchestrations. To create it, the user will be using an Action. An action or otherwise known as a connector, e.g., Facebook, Outlook, Twitter, etc. To enable users to track data from their Business Logic into Serverless360 BAM, we provide this connector.

Suppose users are using Logic Apps or Power Automate. The user might want to use the custom connector and add the custom connector using the JSON definition for the connector. Click Here to download it.

How does Business Activity Monitoring affect business management?

Apart from everything mentioned, users would also seek the same or added benefits from a business perspective. Serverless360 caught hold of this point and curated the BAM feature at a business level. Below are some expectations raised from our customers,

  • Notify my stakeholders of failed transactions
  • Reprocess the failed transactions
  • Track based on details like ID, Name or Location
  • Perform better analysis with tracked data

Serverless360 came up with BAM, a feature set that would ease work for all organization members considering all these points.

Distributed Tracing

End-to-End distributed tracing is the core benefit attained from the Serverless360 BAM. Consider the above mentioned Cab Booking application, and there would be a need to track the Driver Id, User Id, and Location. Configuring the necessary properties while creating the business process can be tracked in the BAM section.

User can even archive the whole messages and their header that is flowing through each stage. Thus, it is also possible to be aware of the status of every stage and hence the transaction.

From the picture above, it is clear that even a support person can easily understand and track the business data flowing through the Azure services.

Querying

In Serverless360, BAM user can experience advanced filtering with the help of Querying. However, when multiple business processes are getting tracked in the BAM, there would be a need for some efficient filtering mechanism to stay focused. With Search queries in BAM, user can easily filter the Business processes from various perspectives. In addition to query filtering, it also possible to filter based on the time interval.

User can also save the query and use it for Monitoring and Analytics. Tracked Transactions can be queried for specific results based on the transaction status and tracked properties in a much user-friendly manner. The queries also support the LIKE operator, and we can also group multiple search query clause using AND — OR Operators, which helps us retrieve more focused records. For example, if I want to retrieve only the employees from the development branch, I can use the Query Branch = “Development”, which returns only the required records.

Reprocessing

In this scenario, a user booked a cab, and a driver was assigned. Soon after the booking, the driver went offline, and this transaction would fail at the driver validation stage of the transaction. Another available driver should be assigned to restore this transaction and complete the booking.

With the help of Reprocessing, the Support person himself can change the required data and reprocess the message to the stage configured with reprocessing. Serverless360 provides four types of reprocessing endpoints. They are as follows,

  • HTTP Endpoints
  • Service Bus Queue
  • Service Bus Topic
  • Event Grid Topic

The message body archived at the selected stage will be sent to the configured reprocess endpoints which also helps reprocess the failed instances by investigating the failure later.

Exception Handling

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

The exceptions could pop up at any instance and stage due to invalid data, system errors, or user errors. For example, 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. These parameters can get tracked in the BAM section by configuring the necessary properties while creating the business process.

User can even archive the whole messages and their header at each stage. It is also possible to know the status of each stage and the transaction.

Exceptions can get tracked 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 gets deployed, the user can handle the exceptions in the Logic App by providing the necessary information into the BAM connector. 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 shown in the above image. Use the try-catch along with the checkpoint library to track the exception that is occurred in the code. Monitoring

We can also set up Monitors to monitor the transactions occurring in a flow. There are two types of monitors available for BAM. They are,

  • Query Monitors
  • Exception Monitors

Query Monitoring

Query monitors monitor the transactions by periodically querying the transactions with the configured query and validating the results against the configured threshold error and warning values. The user will have to enable the Rules Evaluation Frequency and Maximum alerts per hour to receive the query alerts. The rules evaluation frequency will calculate the next run time considering the configured start time and selected frequency. For example, if the schedule is to run every 15 minutes, the rules evaluation frequency will fetch the number of records from the Serverless360 tracked data based on the configured query monitor.

Exception Monitoring

BAM allows users to log exceptions along with exception codes in the stages of the business transaction. The logged exceptions will get displayed to the users on selecting the transaction instance. Users will also need 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.

Exception alerts from BAM can get filtered to prevent spamming of notifications in our inbox. There are a variety of filtering options available in the Business process monitor that are,

  • Max Alerts
  • Frequency
  • Per Exception Code
  • Per Transaction

Users will be able to see the list of alerts generated for Query Alert and Exception Alert under Alert History

Analytics

Today, most business processes happen in real-time environments. Most business users would require an aggregate of information, like how exactly is business process X doing? Is there any anomaly in the number of transactions? Etc. This information can only be based on data trends. Any data trends need to be plotted as a chart to be better understood

We can set up dashboards to visualize the trend of our business process. We can create multiple widgets with different queries. It also helps in understanding our business by viewing the transactions grouped by tracked properties. This kind of business dashboards can be created in Serverless360 BAM.

Analytics Dashboard will get automatically created when a business process gets created newly. This Auto-Generated Dashboard will give insights on the Number of failed Transactions, Successful transactions, and more. Users can also customize this dashboard as per the requirement.

Lower the TCO

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

Use case Implementations

To have a hands-on experience on how BAM can be helpful from a business perspective, we will see a real-time use case that we implemented for our customer. This use case will provide a better understanding of how BAM benefits the real-time business.

Challenges in the Existing System

For the HR team, providing access to different systems/applications or tools is complicated if done manually for every new employee. Thus, organizations are trying to automate this task using various cloud services. But this approach brings a lack of message visibility, and if an error occurs in any one stage, it is difficult for the HR team to identify the error and reprocess it. Even for the identified errors, we should reprocess from the first stage of the business process-this ends up having a duplicate id for the same employee.

During the migration to a new system, employee data gets processed simultaneously. The most significant challenge here is to narrow down the record to a single employee’s data. Any failed transaction may leave unnoticed as a massive number of transactions are happening.

Advantages of instrumenting BAM

  • With BAM, you can instrument your business process to track the business-critical data flowing in the business process and search for any transaction in it using the tracked properties.
  • The simplified view of your business process allows the HR team to review issues and progress. Even without touching the technical components HR team can make some quick fixes.
  • With Action required tabs in BAM, concentrate only on the failed transaction without missing out on any. Utilizing the BAM query, the user can filter records based on the transaction property like Emp_Name, Emp_Id, etc.
  • With a better GUI, get to know in which stage of the business transaction the error lies. Even a non-technical person can also understand what is happening in their business process.
  • Reprocess a failed transaction to any stage of your business process right from the Serverless360 portal. It reduces the user’s effort in switching between applications/portal.
  • The actionable dashboard enables a user to perform better analytics. User need not spend much time understanding business health. Serverless360’s BAM dashboard helps users to take business-critical decisions effectively.

What are the uses of BAM? — A quick summary

Here is a quick summary of the benefits of BAM discussed in this Pillar Page:

  • User can view tracked data from a business point of view rather than a technical point of view
  • It is possible to track the properties at different stages in a Microsoft flow
  • It is possible to filter or search the transaction instances based on the configured properties in addition to the status of the runs or transaction instances
  • It is possible to get alerted whenever there is an exception logged in the stages of the Microsoft flow
  • It is possible to set up a custom user access policy so that users having only the required privileges can access the message content tracked in the Microsoft flow
  • We can set up a customized dashboard to monitor the transactions happening in a Microsoft flow
  • It is easier to find the exact stage where the transaction instance has failed and fix it with minimal cost
  • It is also possible to track the stages that constitute the same business flow but is present in a completely different infrastructure using the Checkpoint with Correlation action of BAM

Originally published at https://www.serverless360.com.

--

--

Madhavan kovai
Madhavan kovai

No responses yet