SlideShare a Scribd company logo
1 of 16
Download to read offline
Introduction to
MicroProfile Metrics
HASUNUMA Kenji

GlassFish Users Group Japan

k.hasunuma@coppermine.jp

Twitter: @khasunuma
#jjug_ccc #ccc_i1
Why not JMX?
• JXM/RMI is not easy to deal with

• Integration with non-Java is too hard

• Microservices may include 

Java and non-Java environments

-> REST based Metrics API
#jjug_ccc #ccc_i1 @khasunuma
MicroProfie Metrics
• Included MicroProfile 1.2 or later

• Built on JAX-RS and CDI

• Expose system and user metrics

• Using generic text format
#jjug_ccc #ccc_i1 @khasunuma
Key features
• REST endpoint

• Registry -- i.e. Scope

Base, Vendor and Application

• Format

• Prometheus text format: text/plain

• JSON format: application/json
#jjug_ccc #ccc_i1 @khasunuma
REST endpoint
• /metrics by default

e.g. http://localhost:8080/metrics

• With Registry (see later)

• /metrics/base

• /metrics/vendor

• /metrics/application
#jjug_ccc #ccc_i1 @khasunuma
Registry
Store of metrics values:

• Base -- JVM metrics, Required

• Typically obtained from MBean

• Vendor -- Vendor specific metrics

• Application -- User metrics
#jjug_ccc #ccc_i1 @khasunuma
Format (Prometheus)
# TYPE base:cpu_system_load_average gauge

# HELP base:cpu_system_load_average Displays...

base:cpu_system_load_average -1.0

# TYPE base:thread_count counter

# HELP base:thread_count Displays...

base:thread_count 90

# TYPE base:classloader_current_loaded_class_count counter

# HELP base:classloader_current_loaded_class_count Displays...

base:classloader_current_loaded_class_count 11150

# TYPE base:classloader_total_loaded_class_count counter

# HELP base:classloader_total_loaded_class_count Displays...

base:classloader_total_loaded_class_count 11193

# TYPE vendor:system_cpu_load gauge

# HELP vendor:system_cpu_load Display...

vendor:system_cpu_load 0.1491192437579042
#jjug_ccc #ccc_i1 @khasunuma
Format (JSON)
{

"base": {

"cpu.systemLoadAverage": -1,

"thread.count": 90,

"classloader.currentLoadedClass.count": 11150,

"classloader.totalLoadedClass.count": 11193,

},

"vendor": {"system.cpu.load": 0.1491192437579042}

}
#jjug_ccc #ccc_i1 @khasunuma
Simple Metrics
Counter
Gauge
#jjug_ccc #ccc_i1 @khasunuma
Complex Metrics
Meter Histogram Timer
#jjug_ccc #ccc_i1 @khasunuma
How to expose metrics
1. Denote metric(s) as field, method,
constructor, parameter or class

• The way depends on metric types

2. Fire an event to update metric(s)

3. Show metrics using REST endpoint
#jjug_ccc #ccc_i1 @khasunuma
To denote metrics
@Inject

@Metric

Counter counter;
Same as ...

- Meter

- Histogram

- Timer
@Gauge

int gauge() {

...

return value;

}
and more ...
#jjug_ccc #ccc_i1 @khasunuma
To update metrics
• Counter#inc() or Counter#dec()

• Meter#mark()

• Histogram#update()

• Timer#time() & Timer.Context#close()

• Call annotated method:

@Counted, @Metered, @Timed
#jjug_ccc #ccc_i1 @khasunuma
Example: Counter
@Path("ping")
@ApplicationScoped
public class PingResource {
// Expose metrics as counter
// Metrics is exposed as entity name with package
// (Metric name can be customized)
@Inject
@Metric
private Counter counter;
// Increment the counter each method call
@GET
public String ping() {
counter.inc();
return "pong";
}
}
#jjug_ccc #ccc_i1 @khasunuma
Example: Counter
$ curl http://localhost:8080/app/rest/ping
pong
$ curl -H "Accept: application/json" http://localhost:8080/
metrics
{"vendor":{"system.cpu.load":0.06088091680189212},
"base":{"classloader.totalLoadedClass.count":
15949,"cpu.systemLoadAverage":-1.0,"thread.count":
158,"classloader.currentLoadedClass.count":
15944,"jvm.uptime":80989,"memory.committedNonHeap":
127795200,"gc.PS MarkSweep.count":4,"memory.committedHeap":
415760384,"thread.max.count":160,"gc.PS Scavenge.count":
21,"cpu.availableProcessors":4,"thread.daemon.count":
144,"classloader.totalUnloadedClass.count":
5,"memory.usedNonHeap":113395160,"memory.maxHeap":
477626368,"memory.usedHeap":77223776,"gc.PS MarkSweep.time":
1394,"memory.maxNonHeap":-1,"gc.PS Scavenge.time":325}
"application":{"com.example.app.PingResource.counter":1}}
#jjug_ccc #ccc_i1 @khasunuma
What's Metrics?
• New feature of MicroProfile 1.2+

• API for expose metrics value

• Using REST for polyglot environment

• Built on JAX-RS and CDI

• Simple, flexible and generic
#jjug_ccc #ccc_i1 @khasunuma

More Related Content

What's hot

Overview of Mule
Overview of MuleOverview of Mule
Overview of Mulemdfkhan625
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Jeremiah Grossman
 
Anypoint connector dev kit
Anypoint connector dev kitAnypoint connector dev kit
Anypoint connector dev kitSon Nguyen
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_applicationRajarajan Sadhasivam
 
Mule Microsoft Service Bus
Mule Microsoft Service BusMule Microsoft Service Bus
Mule Microsoft Service BusAnkush Sharma
 
Calling database with groovy in mule
Calling database with groovy in muleCalling database with groovy in mule
Calling database with groovy in muleAnirban Sen Chowdhary
 
MuleSoft ESB Composite Source
MuleSoft ESB Composite SourceMuleSoft ESB Composite Source
MuleSoft ESB Composite Sourceakashdprajapati
 
For each component in mule demo
For each component in mule demoFor each component in mule demo
For each component in mule demoSudha Ch
 
Mule accessing multiple database in parallel
Mule accessing multiple database in parallelMule accessing multiple database in parallel
Mule accessing multiple database in parallelAnirban Sen Chowdhary
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gatewayKhan625
 
Database component in mule
Database component in muleDatabase component in mule
Database component in muleRajkattamuri
 

What's hot (20)

Overview of Mule
Overview of MuleOverview of Mule
Overview of Mule
 
Mule jdbc
Mule   jdbcMule   jdbc
Mule jdbc
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
 
Anypoint connector dev kit
Anypoint connector dev kitAnypoint connector dev kit
Anypoint connector dev kit
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_application
 
Mule Microsoft Service Bus
Mule Microsoft Service BusMule Microsoft Service Bus
Mule Microsoft Service Bus
 
Apache ActiveMQ
Apache ActiveMQ Apache ActiveMQ
Apache ActiveMQ
 
Mule jms
Mule   jmsMule   jms
Mule jms
 
Calling database with groovy in mule
Calling database with groovy in muleCalling database with groovy in mule
Calling database with groovy in mule
 
MuleSoft ESB Composite Source
MuleSoft ESB Composite SourceMuleSoft ESB Composite Source
MuleSoft ESB Composite Source
 
For each component in mule demo
For each component in mule demoFor each component in mule demo
For each component in mule demo
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
Mule overview-ppt
Mule overview-pptMule overview-ppt
Mule overview-ppt
 
Mule LDAP Connector
Mule LDAP ConnectorMule LDAP Connector
Mule LDAP Connector
 
Mule accessing multiple database in parallel
Mule accessing multiple database in parallelMule accessing multiple database in parallel
Mule accessing multiple database in parallel
 
Mule: Java Transformer
Mule: Java TransformerMule: Java Transformer
Mule: Java Transformer
 
Mule rabbitmq
Mule rabbitmqMule rabbitmq
Mule rabbitmq
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Database component in mule
Database component in muleDatabase component in mule
Database component in mule
 
Mule soa
Mule soaMule soa
Mule soa
 

Similar to Intro to MicroProfile Metrics

Performance eng prakash.sahu
Performance eng prakash.sahuPerformance eng prakash.sahu
Performance eng prakash.sahuDr. Prakash Sahu
 
Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...Hong-Linh Truong
 
Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...Hong-Linh Truong
 
A Practical Deep Dive into Observability of Streaming Applications with Kosta...
A Practical Deep Dive into Observability of Streaming Applications with Kosta...A Practical Deep Dive into Observability of Streaming Applications with Kosta...
A Practical Deep Dive into Observability of Streaming Applications with Kosta...HostedbyConfluent
 
Microservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesMicroservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesQAware GmbH
 
observability pre-release: using prometheus to test and fix new software
observability pre-release: using prometheus to test and fix new softwareobservability pre-release: using prometheus to test and fix new software
observability pre-release: using prometheus to test and fix new softwareSneha Inguva
 
How to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based WorldHow to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based WorldKen Owens
 
Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...
Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...
Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...Tony Erwin
 
Taking your machine learning workflow to the next level using Scikit-Learn Pi...
Taking your machine learning workflow to the next level using Scikit-Learn Pi...Taking your machine learning workflow to the next level using Scikit-Learn Pi...
Taking your machine learning workflow to the next level using Scikit-Learn Pi...Philip Goddard
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandD
 
IBM MQ - Monitoring and Managing Hybrid Messaging Environments
IBM MQ - Monitoring and Managing Hybrid Messaging EnvironmentsIBM MQ - Monitoring and Managing Hybrid Messaging Environments
IBM MQ - Monitoring and Managing Hybrid Messaging EnvironmentsMarkTaylorIBM
 
MIIMETIQ - M2M framework
MIIMETIQ - M2M frameworkMIIMETIQ - M2M framework
MIIMETIQ - M2M frameworkOriol Rius
 
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...SQUADEX
 
Profiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production EnvironmentProfiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production EnvironmentRaimonds Simanovskis
 
stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...
stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...
stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...NETWAYS
 
Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Uri Cohen
 
Geek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL DatabasesGeek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL DatabasesIDERA Software
 
How to reduce expenses on monitoring
How to reduce expenses on monitoringHow to reduce expenses on monitoring
How to reduce expenses on monitoringRomanKhavronenko
 

Similar to Intro to MicroProfile Metrics (20)

Performance eng prakash.sahu
Performance eng prakash.sahuPerformance eng prakash.sahu
Performance eng prakash.sahu
 
Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...
 
Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...Performance Metrics and Ontology for Describing Performance Data of Grid Work...
Performance Metrics and Ontology for Describing Performance Data of Grid Work...
 
A Practical Deep Dive into Observability of Streaming Applications with Kosta...
A Practical Deep Dive into Observability of Streaming Applications with Kosta...A Practical Deep Dive into Observability of Streaming Applications with Kosta...
A Practical Deep Dive into Observability of Streaming Applications with Kosta...
 
Microservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesMicroservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing Microservices
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
observability pre-release: using prometheus to test and fix new software
observability pre-release: using prometheus to test and fix new softwareobservability pre-release: using prometheus to test and fix new software
observability pre-release: using prometheus to test and fix new software
 
How to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based WorldHow to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based World
 
Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...
Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...
Monitoring Node.js Microservices on CloudFoundry with Open Source Tools and a...
 
Taking your machine learning workflow to the next level using Scikit-Learn Pi...
Taking your machine learning workflow to the next level using Scikit-Learn Pi...Taking your machine learning workflow to the next level using Scikit-Learn Pi...
Taking your machine learning workflow to the next level using Scikit-Learn Pi...
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Monitoring und Metriken im Wunderland
Monitoring und Metriken im WunderlandMonitoring und Metriken im Wunderland
Monitoring und Metriken im Wunderland
 
IBM MQ - Monitoring and Managing Hybrid Messaging Environments
IBM MQ - Monitoring and Managing Hybrid Messaging EnvironmentsIBM MQ - Monitoring and Managing Hybrid Messaging Environments
IBM MQ - Monitoring and Managing Hybrid Messaging Environments
 
MIIMETIQ - M2M framework
MIIMETIQ - M2M frameworkMIIMETIQ - M2M framework
MIIMETIQ - M2M framework
 
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
 
Profiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production EnvironmentProfiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production Environment
 
stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...
stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...
stackconf 2023 | How to reduce expenses on monitoring with VictoriaMetrics by...
 
Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014
 
Geek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL DatabasesGeek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL Databases
 
How to reduce expenses on monitoring
How to reduce expenses on monitoringHow to reduce expenses on monitoring
How to reduce expenses on monitoring
 

More from Kenji HASUNUMA

Life of our small product
Life of our small productLife of our small product
Life of our small productKenji HASUNUMA
 
Jakarta EE: The First Parts
Jakarta EE: The First PartsJakarta EE: The First Parts
Jakarta EE: The First PartsKenji HASUNUMA
 
Introduction to JCA and MDB
Introduction to JCA and MDBIntroduction to JCA and MDB
Introduction to JCA and MDBKenji HASUNUMA
 
Basic method for Java EE Web Profile
Basic method for Java EE Web ProfileBasic method for Java EE Web Profile
Basic method for Java EE Web ProfileKenji HASUNUMA
 
Introduction to JavaFX Dialogs
Introduction to JavaFX DialogsIntroduction to JavaFX Dialogs
Introduction to JavaFX DialogsKenji HASUNUMA
 
Brand New Date and Time API
Brand New Date and Time APIBrand New Date and Time API
Brand New Date and Time APIKenji HASUNUMA
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization FundamentalKenji HASUNUMA
 
JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -Kenji HASUNUMA
 
Introduction to Date and Time API 4
Introduction to Date and Time API 4Introduction to Date and Time API 4
Introduction to Date and Time API 4Kenji HASUNUMA
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Kenji HASUNUMA
 
Introduction to Date and Time API 3
Introduction to Date and Time API 3Introduction to Date and Time API 3
Introduction to Date and Time API 3Kenji HASUNUMA
 
Introduction to Date and Time API 2
Introduction to Date and Time API 2Introduction to Date and Time API 2
Introduction to Date and Time API 2Kenji HASUNUMA
 
Introduction to Date and Time API
Introduction to Date and Time APIIntroduction to Date and Time API
Introduction to Date and Time APIKenji HASUNUMA
 

More from Kenji HASUNUMA (14)

Life of our small product
Life of our small productLife of our small product
Life of our small product
 
Jakarta EE: The First Parts
Jakarta EE: The First PartsJakarta EE: The First Parts
Jakarta EE: The First Parts
 
Introduction to JCA and MDB
Introduction to JCA and MDBIntroduction to JCA and MDB
Introduction to JCA and MDB
 
Basic method for Java EE Web Profile
Basic method for Java EE Web ProfileBasic method for Java EE Web Profile
Basic method for Java EE Web Profile
 
Introduction to JavaFX Dialogs
Introduction to JavaFX DialogsIntroduction to JavaFX Dialogs
Introduction to JavaFX Dialogs
 
Brand New Date and Time API
Brand New Date and Time APIBrand New Date and Time API
Brand New Date and Time API
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization Fundamental
 
JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -
 
Introduction to Date and Time API 4
Introduction to Date and Time API 4Introduction to Date and Time API 4
Introduction to Date and Time API 4
 
Fundamental Java
Fundamental JavaFundamental Java
Fundamental Java
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2
 
Introduction to Date and Time API 3
Introduction to Date and Time API 3Introduction to Date and Time API 3
Introduction to Date and Time API 3
 
Introduction to Date and Time API 2
Introduction to Date and Time API 2Introduction to Date and Time API 2
Introduction to Date and Time API 2
 
Introduction to Date and Time API
Introduction to Date and Time APIIntroduction to Date and Time API
Introduction to Date and Time API
 

Recently uploaded

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Intro to MicroProfile Metrics

  • 1. Introduction to MicroProfile Metrics HASUNUMA Kenji GlassFish Users Group Japan k.hasunuma@coppermine.jp Twitter: @khasunuma #jjug_ccc #ccc_i1
  • 2. Why not JMX? • JXM/RMI is not easy to deal with • Integration with non-Java is too hard • Microservices may include 
 Java and non-Java environments -> REST based Metrics API #jjug_ccc #ccc_i1 @khasunuma
  • 3. MicroProfie Metrics • Included MicroProfile 1.2 or later • Built on JAX-RS and CDI • Expose system and user metrics • Using generic text format #jjug_ccc #ccc_i1 @khasunuma
  • 4. Key features • REST endpoint • Registry -- i.e. Scope
 Base, Vendor and Application • Format • Prometheus text format: text/plain • JSON format: application/json #jjug_ccc #ccc_i1 @khasunuma
  • 5. REST endpoint • /metrics by default
 e.g. http://localhost:8080/metrics • With Registry (see later) • /metrics/base • /metrics/vendor • /metrics/application #jjug_ccc #ccc_i1 @khasunuma
  • 6. Registry Store of metrics values: • Base -- JVM metrics, Required • Typically obtained from MBean • Vendor -- Vendor specific metrics • Application -- User metrics #jjug_ccc #ccc_i1 @khasunuma
  • 7. Format (Prometheus) # TYPE base:cpu_system_load_average gauge # HELP base:cpu_system_load_average Displays... base:cpu_system_load_average -1.0 # TYPE base:thread_count counter # HELP base:thread_count Displays... base:thread_count 90 # TYPE base:classloader_current_loaded_class_count counter # HELP base:classloader_current_loaded_class_count Displays... base:classloader_current_loaded_class_count 11150 # TYPE base:classloader_total_loaded_class_count counter # HELP base:classloader_total_loaded_class_count Displays... base:classloader_total_loaded_class_count 11193 # TYPE vendor:system_cpu_load gauge # HELP vendor:system_cpu_load Display... vendor:system_cpu_load 0.1491192437579042 #jjug_ccc #ccc_i1 @khasunuma
  • 8. Format (JSON) { "base": { "cpu.systemLoadAverage": -1, "thread.count": 90, "classloader.currentLoadedClass.count": 11150, "classloader.totalLoadedClass.count": 11193, }, "vendor": {"system.cpu.load": 0.1491192437579042} } #jjug_ccc #ccc_i1 @khasunuma
  • 10. Complex Metrics Meter Histogram Timer #jjug_ccc #ccc_i1 @khasunuma
  • 11. How to expose metrics 1. Denote metric(s) as field, method, constructor, parameter or class • The way depends on metric types 2. Fire an event to update metric(s) 3. Show metrics using REST endpoint #jjug_ccc #ccc_i1 @khasunuma
  • 12. To denote metrics @Inject @Metric Counter counter; Same as ... - Meter - Histogram - Timer @Gauge int gauge() { ... return value; } and more ... #jjug_ccc #ccc_i1 @khasunuma
  • 13. To update metrics • Counter#inc() or Counter#dec() • Meter#mark() • Histogram#update() • Timer#time() & Timer.Context#close() • Call annotated method:
 @Counted, @Metered, @Timed #jjug_ccc #ccc_i1 @khasunuma
  • 14. Example: Counter @Path("ping") @ApplicationScoped public class PingResource { // Expose metrics as counter // Metrics is exposed as entity name with package // (Metric name can be customized) @Inject @Metric private Counter counter; // Increment the counter each method call @GET public String ping() { counter.inc(); return "pong"; } } #jjug_ccc #ccc_i1 @khasunuma
  • 15. Example: Counter $ curl http://localhost:8080/app/rest/ping pong $ curl -H "Accept: application/json" http://localhost:8080/ metrics {"vendor":{"system.cpu.load":0.06088091680189212}, "base":{"classloader.totalLoadedClass.count": 15949,"cpu.systemLoadAverage":-1.0,"thread.count": 158,"classloader.currentLoadedClass.count": 15944,"jvm.uptime":80989,"memory.committedNonHeap": 127795200,"gc.PS MarkSweep.count":4,"memory.committedHeap": 415760384,"thread.max.count":160,"gc.PS Scavenge.count": 21,"cpu.availableProcessors":4,"thread.daemon.count": 144,"classloader.totalUnloadedClass.count": 5,"memory.usedNonHeap":113395160,"memory.maxHeap": 477626368,"memory.usedHeap":77223776,"gc.PS MarkSweep.time": 1394,"memory.maxNonHeap":-1,"gc.PS Scavenge.time":325} "application":{"com.example.app.PingResource.counter":1}} #jjug_ccc #ccc_i1 @khasunuma
  • 16. What's Metrics? • New feature of MicroProfile 1.2+ • API for expose metrics value • Using REST for polyglot environment • Built on JAX-RS and CDI • Simple, flexible and generic #jjug_ccc #ccc_i1 @khasunuma