SlideShare a Scribd company logo
May 26th, 2021
¿Cómo generar e implementar
monitoreo para aplicaciones de
Mule?
Paola Alcantar Valdes
2
● About me
● What is a Health Monitoring
● Importance of implementing a Health Monitoring
● Health Monitoring application objectives
● Application metricts to watch
● Building a basic Health Monitoring for Mule Application
● How to implement a Health Monitoring Library in a Mule Application
● DEMO – Basic Health Monitoring for Mule Application
● Questions
Agenda
3
●Paola Alcantar Valdes
○ Jr. Integration Engineer with Mulesoft at Twitter
○ Mulesoft Certified Developer – Level 1 (Mule 4)
○ Over two years of experience as a Managed Services
About me
Importance of implementing a health monitoring
What is a Health Monitoring?
5
● What is a Health Monitoring?
○ It is an application that continually checks the status of an integration that is running.
● Differences between Application Health Monitoring and Application Health Checks:
○ Application Health Monitoring:
○ It is a good practice that allows collecting key metrics about different aspects of an application to
watch how it's working over time.
○ Application Health Checks:
○ Definition of “healthy” parameters based on regular checks information to ensure the system is
working the way it’s expected to.
○ Based on a business logic criteria, this should not be just “black“ or “white“
Health Monitoring
6
● Importance of implementing a Health Monitoring:
○ It allows you to detect issues before they become complete outages. It will help you to detect
incidents before they affect customers.
○ Building and implementing a health monitoring application will help you create an action plan if an
incident does pop up.
○ A health monitoring application will allow helping you to understand better the behavior of
applications, servers, external systems. Also, to close visibility and performance gaps, correct
processes, and ensure you're getting total value from your applications.
Health Monitoring
Application metricts to watch
Health Monitoring application
objectives
8
● There is no single way to build health monitoring for your applications. It is why different IT
teams will have different perspectives about the thing you need to care about. However, a
basic and useful health monitoring application might consider the following aspects.
○ Application’s general information: Get application name, application version, application environment,
mule runtime version, etc.
○ Memory Information: Get Heap Memory, Non-Heap Memory, Garbage Collection information from JVM.
○ Thread information: Return the number of demon threads, non-demon threads, and peak threads.
○ Overall availability (External systems): Retrieve the status of the external system with which the
application interacts (Know if external systems are up-and-running or not).
Health Monitoring application objectives
9
● Application’s general information:
Health Monitoring application objectives
%dw 2.0
output application/json
---
{
apiName: app.name,
apiVersion: p("apiVersion") default "",
env: p("env") default "",
runtimeVersion: mule.version,
startDate: ((app.muleContext.startDate default now()) as DateTime
{unit: "milliseconds"}),
timeZone: server.timeZone,
traceId: correlationId,
}
10
● Memory Information :
Health Monitoring application objectives
public static void heapMemoryDetails() {
MemoryMXBean memBean = ManagementFactory.getMemoryMXBean() ;
MemoryUsage heapMemoryUsage = memBean.getHeapMemoryUsage();
long heapInitSize = heapMemoryUsage.getInit();
long heapUsedSize = heapMemoryUsage.getUsed();
long heapCommitedSize = heapMemoryUsage.getCommitted();
long heapMaxSize = heapMemoryUsage.getMax();
}
11
● Garbage Collection Information :
Health Monitoring application objectives
public static ArrayList<GarbageCollection> garbageCollection(){
ArrayList<GarbageCollectorMXBean> memBean =
(ArrayList<GarbageCollectorMXBean>)
ManagementFactory.getGarbageCollectorMXBeans();
ArrayList<GarbageCollection> gc = new
ArrayList<GarbageCollection>();
for (GarbageCollectorMXBean garbageCollectorMXBean : memBean)
{
gc.add(new
GarbageCollection(garbageCollectorMXBean.getName(),
garbageCollectorMXBean.getCollectionCount(),
garbageCollectorMXBean.getCollectionTime()));
}
return gc;
}
12
● Thread information :
Health Monitoring application objectives
public static void threadInformation() {
int demonThreads =
ManagementFactory.getThreadMXBean().getDaemonThreadCount();
int peakThreads =
ManagementFactory.getThreadMXBean().getPeakThreadCount();
int threadCount =
ManagementFactory.getThreadMXBean().getThreadCount();
long startedThreadCount =
ManagementFactory.getThreadMXBean().getTotalStartedThreadCount();
}
Building a basic Health
Monitoring for Mule Application
14
1. Create a Mule 4 application.
2. Update the pom.xml file to define the “classifier” of the mule application as a “mule-plugin”.
3. Define the endpoints for the health monitoring library in a RAML Definition file. For example:
○ /health/application
○ /health/server
○ /health/thirdParty
○ /health/general
Walkthrough: How to build a Health Monitoring for
Mule Applications
See Health Monitoring RAML Definition
File
15
4. Define the response for each endpoint.
5. Generate Flows based on RAML Definition file.
6. Remove auto-generated HTTP Configuration.
7. Set “config-ref” value on HTTP Listener Configuration with “${health.http.config}”
Walkthrough: How to build a Health Monitoring for
Mule Applications
See Health Monitoring application
objectives
Note: Value of “health.http.config” property will be defined in each mule
application that implements health monitoring library.
16
8. Get objective keys related to each endpoint.
9. Generate dataweave scripts to format endpoint responses. For example:
10. Install our health monitoring plugin into a repository using command mvn clean install.
11. Implement health monitoring library following next steps.
Walkthrough: How to build a Health Monitoring for
Mule Applications
See Health Monitoring RAML Definition
File
%dw 2.0
output application/json
---
{
apiName: app.name,
apiVersion: p("apiVersion") default "",
env: p("env") default "",
runtimeVersion: mule.version,
startDate: ((app.muleContext.startDate default now()) as DateTime {unit: "milliseconds"}),
timeZone: server.timeZone,
traceId: correlationId,
}
How to implement a Health
Monitoring Library in a Mule
Application
Walkthrough: How to implement a Health
Monitoring Library
1. Add the Health Monitoring library dependency to our mule application pom.xml file.
2. Import into our mule application the mule configuration files from the library.
3. Define the following properties into our mule application. The thirdPartyFlows property is
optional and does not need to be defined.
18
Walkthrough to implement the Health Monitoring
Library
4. Optional. Define subflows that will be used to ´ping´ external systems.
19
Important: The subflows are in charge of calling external systems
to validate that service is up and running. Those subflows are
defined in our mule application, and they are called from the
health monitoring library through the property “thirdPartyFlows”.
DEMO – Basic Health Monitoring
of Mule Application
21
● http://test-health-monitoring.us-e2.cloudhub.io/api/health/application
● http://test-health-monitoring.us-e2.cloudhub.io/api/health/server
● http://test-health-monitoring.us-e2.cloudhub.io/api/health/thirdParty
● http://test-health-monitoring.us-e2.cloudhub.io/api/health/general
Health Monitoring Endpoints
Questions?
23
● https://docs.mulesoft.com/mule-runtime/4.3/dataweave-variables-context
● https://docs.mulesoft.com/java-module/1.2/java-invoke-method
● https://docs.oracle.com/javase/9/docs/api/java/lang/management/MemoryUsage.html
● https://docs.oracle.com/javase/9/docs/api/java/lang/management/GarbageCollectorMXBean.ht
ml
● https://docs.oracle.com/javase/9/docs/api/java/lang/management/ThreadMXBean.html
● https://github.com/paola-alcval/health-monitoring-library
● https://github.com/paola-alcval/test-health-monitoring
● https://github.com/paola-alcval/test-weather-api
Helpful links
24
Personal email address:
paola.alcval@gmail.com
LinkedIn:
https://www.linkedin.com/in/paola-alcantar-valdes-a74087b3/
Twitter:
@PaoAlcVal
Contact me
Thank you

More Related Content

PDF
Matteo Meucci OWASP Testing Guide v4
PDF
Munit Mule ESB
PDF
What's New in AppFuse 2.0
PDF
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
PPTX
Dot Net performance monitoring
PDF
SE_chap1.pdf
PDF
Hospital Management System Project
PPTX
Android application development
Matteo Meucci OWASP Testing Guide v4
Munit Mule ESB
What's New in AppFuse 2.0
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
Dot Net performance monitoring
SE_chap1.pdf
Hospital Management System Project
Android application development

Similar to Cómo generar e implementar monitoreo para aplicaciones de Mule (20)

PPTX
PreMonR - A Reactive Platform To Monitor Reactive Application
PDF
Top DevOps Monitoring Tools in 2024- Headspin
PPTX
What is HTTP Monitor and Why Do You Need It
PDF
Websphere doctor - your guide to diagnose issues
PPTX
Software engineering project guidelines.pptx
PPTX
Software engineering project guidelines.pptx
PDF
Abstraction and Automation: A Software Design Approach for Developing Secure ...
PDF
J017325660
PDF
beginners-guide-to-observability.pdf
PDF
Data Warehouses & Deployment By Ankita dubey
PDF
Srs dispensary-management
PDF
Clinic management system
PDF
IRJET- Application Backup and Restore across Multiple Devices
PPTX
week-3.pptx.............................
PDF
Software Engineering Important Short Question for Exams
PPTX
SAD_SDLC.pptx
PPTX
Google app engine
PDF
Healthcare Management System for paperless management
PPTX
Observability vs APM vs Monitoring Comparison
DOCX
hospital management system.docx
PreMonR - A Reactive Platform To Monitor Reactive Application
Top DevOps Monitoring Tools in 2024- Headspin
What is HTTP Monitor and Why Do You Need It
Websphere doctor - your guide to diagnose issues
Software engineering project guidelines.pptx
Software engineering project guidelines.pptx
Abstraction and Automation: A Software Design Approach for Developing Secure ...
J017325660
beginners-guide-to-observability.pdf
Data Warehouses & Deployment By Ankita dubey
Srs dispensary-management
Clinic management system
IRJET- Application Backup and Restore across Multiple Devices
week-3.pptx.............................
Software Engineering Important Short Question for Exams
SAD_SDLC.pptx
Google app engine
Healthcare Management System for paperless management
Observability vs APM vs Monitoring Comparison
hospital management system.docx
Ad

More from Alexandra N. Martinez (20)

PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
PDF
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
PPTX
Montréal Dreamin'24 - Get Started with ACB
PPTX
Dreamin in Color '24 - (Workshop) Design an API Specification with MuleSoft's...
PDF
Mejora tu productividad creando aplicaciones de Slack
PDF
Women Who Mule - Workshop series #2: Ghost
PPTX
Women Who Mule - Workshop series: Create your own blog from scratch without a...
PDF
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
PDF
Women Who Mule - June Meetup (EMEA)
PPTX
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
PPTX
reCONNECT 2021 May Meetup - Women Who Mule #4
PPTX
Women Who Mule - April Meetup (Diane Kesler's Journey)
PPTX
Toronto Virtual Meetup #9 - KPIs and metrics accelerator
PPTX
Reviewing a complex dataweave transformation use case v3
PPTX
Introduction to MuleSoft
PPTX
What is munit and how to create your first unit test
PDF
Truly Human part 1
PPTX
Toronto Virtual Meetup #8 - Tips for Reusability
PPTX
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montréal Dreamin'24 - Get Started with ACB
Dreamin in Color '24 - (Workshop) Design an API Specification with MuleSoft's...
Mejora tu productividad creando aplicaciones de Slack
Women Who Mule - Workshop series #2: Ghost
Women Who Mule - Workshop series: Create your own blog from scratch without a...
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Women Who Mule - June Meetup (EMEA)
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
reCONNECT 2021 May Meetup - Women Who Mule #4
Women Who Mule - April Meetup (Diane Kesler's Journey)
Toronto Virtual Meetup #9 - KPIs and metrics accelerator
Reviewing a complex dataweave transformation use case v3
Introduction to MuleSoft
What is munit and how to create your first unit test
Truly Human part 1
Toronto Virtual Meetup #8 - Tips for Reusability
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
Ad

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Cell Structure & Organelles in detailed.
PDF
Pre independence Education in Inndia.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Pharma ospi slides which help in ospi learning
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Complications of Minimal Access Surgery at WLH
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Cell Types and Its function , kingdom of life
Cell Structure & Organelles in detailed.
Pre independence Education in Inndia.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Pharma ospi slides which help in ospi learning
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Microbial diseases, their pathogenesis and prophylaxis
Insiders guide to clinical Medicine.pdf
Final Presentation General Medicine 03-08-2024.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPH.pptx obstetrics and gynecology in nursing
VCE English Exam - Section C Student Revision Booklet
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Complications of Minimal Access Surgery at WLH
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES

Cómo generar e implementar monitoreo para aplicaciones de Mule

  • 1. May 26th, 2021 ¿Cómo generar e implementar monitoreo para aplicaciones de Mule? Paola Alcantar Valdes
  • 2. 2 ● About me ● What is a Health Monitoring ● Importance of implementing a Health Monitoring ● Health Monitoring application objectives ● Application metricts to watch ● Building a basic Health Monitoring for Mule Application ● How to implement a Health Monitoring Library in a Mule Application ● DEMO – Basic Health Monitoring for Mule Application ● Questions Agenda
  • 3. 3 ●Paola Alcantar Valdes ○ Jr. Integration Engineer with Mulesoft at Twitter ○ Mulesoft Certified Developer – Level 1 (Mule 4) ○ Over two years of experience as a Managed Services About me
  • 4. Importance of implementing a health monitoring What is a Health Monitoring?
  • 5. 5 ● What is a Health Monitoring? ○ It is an application that continually checks the status of an integration that is running. ● Differences between Application Health Monitoring and Application Health Checks: ○ Application Health Monitoring: ○ It is a good practice that allows collecting key metrics about different aspects of an application to watch how it's working over time. ○ Application Health Checks: ○ Definition of “healthy” parameters based on regular checks information to ensure the system is working the way it’s expected to. ○ Based on a business logic criteria, this should not be just “black“ or “white“ Health Monitoring
  • 6. 6 ● Importance of implementing a Health Monitoring: ○ It allows you to detect issues before they become complete outages. It will help you to detect incidents before they affect customers. ○ Building and implementing a health monitoring application will help you create an action plan if an incident does pop up. ○ A health monitoring application will allow helping you to understand better the behavior of applications, servers, external systems. Also, to close visibility and performance gaps, correct processes, and ensure you're getting total value from your applications. Health Monitoring
  • 7. Application metricts to watch Health Monitoring application objectives
  • 8. 8 ● There is no single way to build health monitoring for your applications. It is why different IT teams will have different perspectives about the thing you need to care about. However, a basic and useful health monitoring application might consider the following aspects. ○ Application’s general information: Get application name, application version, application environment, mule runtime version, etc. ○ Memory Information: Get Heap Memory, Non-Heap Memory, Garbage Collection information from JVM. ○ Thread information: Return the number of demon threads, non-demon threads, and peak threads. ○ Overall availability (External systems): Retrieve the status of the external system with which the application interacts (Know if external systems are up-and-running or not). Health Monitoring application objectives
  • 9. 9 ● Application’s general information: Health Monitoring application objectives %dw 2.0 output application/json --- { apiName: app.name, apiVersion: p("apiVersion") default "", env: p("env") default "", runtimeVersion: mule.version, startDate: ((app.muleContext.startDate default now()) as DateTime {unit: "milliseconds"}), timeZone: server.timeZone, traceId: correlationId, }
  • 10. 10 ● Memory Information : Health Monitoring application objectives public static void heapMemoryDetails() { MemoryMXBean memBean = ManagementFactory.getMemoryMXBean() ; MemoryUsage heapMemoryUsage = memBean.getHeapMemoryUsage(); long heapInitSize = heapMemoryUsage.getInit(); long heapUsedSize = heapMemoryUsage.getUsed(); long heapCommitedSize = heapMemoryUsage.getCommitted(); long heapMaxSize = heapMemoryUsage.getMax(); }
  • 11. 11 ● Garbage Collection Information : Health Monitoring application objectives public static ArrayList<GarbageCollection> garbageCollection(){ ArrayList<GarbageCollectorMXBean> memBean = (ArrayList<GarbageCollectorMXBean>) ManagementFactory.getGarbageCollectorMXBeans(); ArrayList<GarbageCollection> gc = new ArrayList<GarbageCollection>(); for (GarbageCollectorMXBean garbageCollectorMXBean : memBean) { gc.add(new GarbageCollection(garbageCollectorMXBean.getName(), garbageCollectorMXBean.getCollectionCount(), garbageCollectorMXBean.getCollectionTime())); } return gc; }
  • 12. 12 ● Thread information : Health Monitoring application objectives public static void threadInformation() { int demonThreads = ManagementFactory.getThreadMXBean().getDaemonThreadCount(); int peakThreads = ManagementFactory.getThreadMXBean().getPeakThreadCount(); int threadCount = ManagementFactory.getThreadMXBean().getThreadCount(); long startedThreadCount = ManagementFactory.getThreadMXBean().getTotalStartedThreadCount(); }
  • 13. Building a basic Health Monitoring for Mule Application
  • 14. 14 1. Create a Mule 4 application. 2. Update the pom.xml file to define the “classifier” of the mule application as a “mule-plugin”. 3. Define the endpoints for the health monitoring library in a RAML Definition file. For example: ○ /health/application ○ /health/server ○ /health/thirdParty ○ /health/general Walkthrough: How to build a Health Monitoring for Mule Applications See Health Monitoring RAML Definition File
  • 15. 15 4. Define the response for each endpoint. 5. Generate Flows based on RAML Definition file. 6. Remove auto-generated HTTP Configuration. 7. Set “config-ref” value on HTTP Listener Configuration with “${health.http.config}” Walkthrough: How to build a Health Monitoring for Mule Applications See Health Monitoring application objectives Note: Value of “health.http.config” property will be defined in each mule application that implements health monitoring library.
  • 16. 16 8. Get objective keys related to each endpoint. 9. Generate dataweave scripts to format endpoint responses. For example: 10. Install our health monitoring plugin into a repository using command mvn clean install. 11. Implement health monitoring library following next steps. Walkthrough: How to build a Health Monitoring for Mule Applications See Health Monitoring RAML Definition File %dw 2.0 output application/json --- { apiName: app.name, apiVersion: p("apiVersion") default "", env: p("env") default "", runtimeVersion: mule.version, startDate: ((app.muleContext.startDate default now()) as DateTime {unit: "milliseconds"}), timeZone: server.timeZone, traceId: correlationId, }
  • 17. How to implement a Health Monitoring Library in a Mule Application
  • 18. Walkthrough: How to implement a Health Monitoring Library 1. Add the Health Monitoring library dependency to our mule application pom.xml file. 2. Import into our mule application the mule configuration files from the library. 3. Define the following properties into our mule application. The thirdPartyFlows property is optional and does not need to be defined. 18
  • 19. Walkthrough to implement the Health Monitoring Library 4. Optional. Define subflows that will be used to ´ping´ external systems. 19 Important: The subflows are in charge of calling external systems to validate that service is up and running. Those subflows are defined in our mule application, and they are called from the health monitoring library through the property “thirdPartyFlows”.
  • 20. DEMO – Basic Health Monitoring of Mule Application
  • 21. 21 ● http://test-health-monitoring.us-e2.cloudhub.io/api/health/application ● http://test-health-monitoring.us-e2.cloudhub.io/api/health/server ● http://test-health-monitoring.us-e2.cloudhub.io/api/health/thirdParty ● http://test-health-monitoring.us-e2.cloudhub.io/api/health/general Health Monitoring Endpoints
  • 23. 23 ● https://docs.mulesoft.com/mule-runtime/4.3/dataweave-variables-context ● https://docs.mulesoft.com/java-module/1.2/java-invoke-method ● https://docs.oracle.com/javase/9/docs/api/java/lang/management/MemoryUsage.html ● https://docs.oracle.com/javase/9/docs/api/java/lang/management/GarbageCollectorMXBean.ht ml ● https://docs.oracle.com/javase/9/docs/api/java/lang/management/ThreadMXBean.html ● https://github.com/paola-alcval/health-monitoring-library ● https://github.com/paola-alcval/test-health-monitoring ● https://github.com/paola-alcval/test-weather-api Helpful links