Today’s integration scenarios span across boundaries. This brings its own challenges, one of them is getting the end-to-end visibility of your transactions. In any kind of integration solution, there is a need for the most organization to build end-to-end traceability/monitoring solution that can be used by the business users. The simplest and best example could be – Where is my booking acknowledgment?
Typically, teams spend about 20-30% of their time addressing this challenge by building custom solutions like Logging Components and Web Dashboards.
Most of the time the solution will be premature since building an enterprise-grade tracking/monitoring solution requires enormous effort. That’s exactly the challenge we are solving in Serverless360 with Business Activity Monitoring (BAM) feature.
This article will serve as a guide to achieve effective Business Activity Monitoring on your Azure Serverless application using Serverless360.
Scope of this article would be:
- Defining Business Process in Serverless360.
- Instrumenting Logic Apps with BAM connectors to send the tracked data to Serverless360.
- Enabling end to end tracking and analysis.
To have the better understanding of the process, let’s consider a real time cab booking scenario in Fly Wheels Cab booking application.
In this scenario, whenever the user books a cab in the FlyWheelCabs application, the web client will send the booking message to the Service Bus Queue named bookinghandler. Now, the Logic App named BookingProcessor will get triggered when there is a new message in the bookinghandler Queue.
This Logic App will check if the user details and driver details are valid with Function App named ValidateBooking. Depending on if both the details are valid or invalid, those messages will be sent to Service Bus Topic datavalidator with appropriate label. The Topic consists of 2 Topic subscriptions ValidDatavalidator and InValidDatavalidator. Based on the Topic subscription rules defined, messages will be automatically moved to the concerned subscription.
Now, we are going to track the transaction and every stage in the above scenario with Serverless360 BAM. To track the Business Process, we need to do some instrumentation in Serverless360 as well as in the Logic App.
- Define Business Process
To perform end to end tracking of the Business Process in the BAM section of a Composite Application in Serverless360, the Business Process should be defined.
Before proceeding further, we strongly recommend reading this article on – What are Business Processes?
- On the left navigation bar in Serverless360 application home page, Business Process menu can be found.
- click Add Business Process button to add a new one.
- You will be navigated to Business Process section. There exists the option to define the Business Process. In this scenario, the Business Process is named as BookingValidation.
- Add transactions to the Business Process. Add transaction named DetailsValidator, direction would be inbound and click save. we can add any number of transactions as per the business need.
- Now, we need to define the stages those will be involved in the Business Process. In this scenario, we can define stages for message into the Queue, details validation by Azure Functions and sending message to Service Bus Topic.
- To define a stage, click + button in the transaction to add the stages. I have defined the stages with the name MsgRecvdInQueue which denotes the trigger connector of Logic App, DetailsValidationFunc_U which denotes the validation of user details with Function App, DetailsValidationFunc_D corresponds to the validation of driver details with Function App and SendMsgToTopic which denotes sending validated messages to Topic subscriptions.
- Reprocessing setting can be configured with HTTP endpoint, Service Bus Queue or Topic and Event Grid as required. For this case, I have defined the reprocess to bookinghandler Service Bus Queue.
Here is how the final configuration should be:
Read more about defining Business Process here
We have defined the Business Process, transaction and stages. Now, let’s instrument the Logic Apps with BAM connectors to track our orchestration against the defined Business Process.
Below is the design view of the Logic App defining the Fly wheels Cab booking application, which needs to be instrumented with the Serverless360 BAM connectors.
Serverless360 BAM Connector for Logic App can be found in the Azure portal.
Every stage in the Business Process will map to a Start Activity and Update Activity.
In this connector, we need to pass the Service Bus data that need to be tracked into Message Body, Message Header. Set Business Process name as BookingValidation, Business transaction as DetailsValidation, Stage name as MsgRecvdInQueue to define first stage of the Business Process. If the message content should be displayed in the Serverless360 portal, then set the value of Archive message to True.
We have defined the Start an activity. Now, we should define the Update an Activity connector to complete the Stage. Define the MainActivityId, StageActivityId of the corresponding Start an Activity connector, Business Process name, Business Transaction name and Current Stage name that need to be completed. Whenever the Logic App gets triggered MsgRecvdInQueue stage will be tracked in the BAM of Serverless360.
As of now, we have defined the first stage of the Business Process. Now, we need to do the same process for user and driver details validation Function App as below:
In the Start an Activity 2 connector we need to define the MainActivityId and PreviousStage name and Currentstage as DetailsValidationFunc_D for driver details validation Function and DetailsValidationFunc_U for user details validation Function as below:
Till now, we have instrumented the Logic App to track till details validation.
The next Logic App action sends the message to Service Bus Topic named datavalidator with the value for label as true if both user and driver details are valid or false if any one of the details is invalid.
Here is how it should be defined:
As a user, I wanted to get intimated when there is an invalid user or driver so we can use Log an exception connector to log the exception message as invalid user or driver details. Below is configuration for log an exception:
Mark the status of the Update an activity 5 as Failure.
Read more about BAM connectors and configuration here.
To track the Business Process, we need to associate the Business Process into the appropriate Composite Application.
- Go to BAM section in a Composite Application. click Manage Business Process button and select BookingValidation Business Process.
- Once the Business Process is defined and instrumented, end to end tracking on the Business Process is possible.
- Below is the graphical view of the Business Process we configured when a user or driver details are invalid.
Now, it is possible to view the in-depth details of every stage, view tracked properties and repair & reprocess the failed Business Process to any of stage configured with the reprocessing setting.
Read more about BAM association here.
Analytics on the collected BAM information is critical to make strategic business decisions. Serverless360 offers the BAM Analytics which addresses this need. Let’s see how we can configure the BAM Analytics for cab booking Scenario.
- Create the Analytics Dashboard, so go to BAM Analytics section and click New Dashboard.
- Give a name to the Dashboard as Staging Booking Management and click the Add Widget. For this scenario, I am creating Widgets which gives a complete overview of bookings at various cities (Pie chart), the booking trend of a user (Bar chart) and driver location (Line chart).
- For adding the Widget, we need to provide the Name, Query with which the Widget should provide the Insights, Period and Report Type. If the Query is blank it will process for all transaction records of the Business Processes in that Composite Application.
- After creating the Widgets and Dashboard, we get the Analytics of the BAM with configurable time interval.
This blog serves as a guide to configure Business Activity Monitoring in Serverless360 for a cab booking scenario. Click here to know more about Business Activity Monitoring in Serverless360.
You can also take a look at our pillar page dedicated to Distributed tracing to get better insights on the topic.