当前位置:网站首页>Is error log monitoring enough? Don't try JVM monitoring of microservices
Is error log monitoring enough? Don't try JVM monitoring of microservices
2022-07-29 10:22:00 【xdd】
Now many companies are using microservices , Some companies are also landing DDD In the business , So has your service been monitored ? Generally, in addition to the monitoring of error logs , Alarm and email 、 Fly Book messages or text messages , Others monitor the database or server , So what do you think of your service JVM Has the level been monitored ?
If not JVM Monitoring of , Then look at the following , I'll tell you one SpringBoot How to do micro Services JVM Level of monitoring ?
SpringBoot application JVM Monitoring practice DEMO
One 、 Increase dependency in services
Two 、 increase Springboot Actuator and promethus To configure
To increase the Springboot Actuator The configuration of is as follows
To increase the prometheus The configuration is as follows :
start-up Springboot After the application , Use as follows URL The following responses can be observed :
request :
http://ip:port/actuator/prometheus
Respond to :
# HELP jvm_gc_memory_promoted_bytes_total Count of positive increases in the size of the old generation memory pool before GC to after GC
# TYPE jvm_gc_memory_promoted_bytes_total counter
jvm_gc_memory_promoted_bytes_total 3.74492E7
# HELP jvm_buffer_count_buffers An estimate of the number of buffers in the pool
# TYPE jvm_buffer_count_buffers gauge
jvm_buffer_count_buffers{id="direct",} 5.0
jvm_buffer_count_buffers{id="mapped",} 0.0
# HELP jvm_gc_live_data_size_bytes Size of old generation memory pool after a full GC
# TYPE jvm_gc_live_data_size_bytes gauge
jvm_gc_live_data_size_bytes 5.3624472E7
# HELP jvm_threads_states_threads The current number of threads having NEW state
# TYPE jvm_threads_states_threads gauge
jvm_threads_states_threads{state="runnable",} 49.0
jvm_threads_states_threads{state="blocked",} 0.0
jvm_threads_states_threads{state="waiting",} 44.0
jvm_threads_states_threads{state="timed-waiting",} 35.0
jvm_threads_states_threads{state="new",} 0.0
jvm_threads_states_threads{state="terminated",} 0.0
# HELP spring_integration_channels The number of message channels
# TYPE spring_integration_channels gauge
spring_integration_channels 2.0
# HELP jvm_memory_max_bytes The maximum amount of memory in bytes that can be used for memory management
# TYPE jvm_memory_max_bytes gauge
jvm_memory_max_bytes{area="heap",id="PS Survivor Space",} 3.145728E7
jvm_memory_max_bytes{area="heap",id="PS Old Gen",} 2.845310976E9
jvm_memory_max_bytes{area="heap",id="PS Eden Space",} 1.354235904E9
jvm_memory_max_bytes{area="nonheap",id="Metaspace",} -1.0
jvm_memory_max_bytes{area="nonheap",id="Code Cache",} 2.5165824E8
jvm_memory_max_bytes{area="nonheap",id="Compressed Class Space",} 1.073741824E9
# HELP jvm_memory_committed_bytes The amount of memory in bytes that is committed for the Java virtual machine to use
# TYPE jvm_memory_committed_bytes gauge
jvm_memory_committed_bytes{area="heap",id="PS Survivor Space",} 3.145728E7
jvm_memory_committed_bytes{area="heap",id="PS Old Gen",} 2.63192576E8
jvm_memory_committed_bytes{area="heap",id="PS Eden Space",} 3.55991552E8
jvm_memory_committed_bytes{area="nonheap",id="Metaspace",} 8.5458944E7
jvm_memory_committed_bytes{area="nonheap",id="Code Cache",} 1.769472E7
jvm_memory_committed_bytes{area="nonheap",id="Compressed Class Space",} 1.1010048E7
# HELP tomcat_sessions_active_current_sessions
# TYPE tomcat_sessions_active_current_sessions gauge
tomcat_sessions_active_current_sessions 0.0
# HELP logback_events_total Number of error level events that made it to the logs
# TYPE logback_events_total counter
logback_events_total{level="warn",} 12.0
logback_events_total{level="debug",} 0.0
logback_events_total{level="error",} 0.0
logback_events_total{level="trace",} 0.0
logback_events_total{level="info",} 56.0
# HELP tomcat_sessions_expired_sessions_total
# TYPE tomcat_sessions_expired_sessions_total counter
tomcat_sessions_expired_sessions_total 0.0
# HELP tomcat_sessions_alive_max_seconds
# TYPE tomcat_sessions_alive_max_seconds gauge
tomcat_sessions_alive_max_seconds 0.0
# HELP jvm_gc_memory_allocated_bytes_total Incremented for an increase in the size of the young generation memory pool after one GC to before the next
# TYPE jvm_gc_memory_allocated_bytes_total counter
jvm_gc_memory_allocated_bytes_total 1.447756672E9
# HELP process_start_time_seconds Start time of the process since unix epoch.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.633764054233E9
# HELP jvm_memory_used_bytes The amount of used memory
# TYPE jvm_memory_used_bytes gauge
jvm_memory_used_bytes{area="heap",id="PS Survivor Space",} 3.143352E7
jvm_memory_used_bytes{area="heap",id="PS Old Gen",} 5.6170736E7
jvm_memory_used_bytes{area="heap",id="PS Eden Space",} 1.45013368E8
jvm_memory_used_bytes{area="nonheap",id="Metaspace",} 8.1185736E7
jvm_memory_used_bytes{area="nonheap",id="Code Cache",} 1.7651712E7
jvm_memory_used_bytes{area="nonheap",id="Compressed Class Space",} 1.0256224E7
# HELP system_cpu_count The number of processors available to the Java virtual machine
# TYPE system_cpu_count gauge
system_cpu_count 8.0
# HELP jvm_classes_loaded_classes The number of classes that are currently loaded in the Java virtual machine
# TYPE jvm_classes_loaded_classes gauge
jvm_classes_loaded_classes 15057.0
# HELP jvm_buffer_total_capacity_bytes An estimate of the total capacity of the buffers in this pool
# TYPE jvm_buffer_total_capacity_bytes gauge
jvm_buffer_total_capacity_bytes{id="direct",} 16400.0
jvm_buffer_total_capacity_bytes{id="mapped",} 0.0
# HELP spring_integration_sources The number of message sources
# TYPE spring_integration_sources gauge
spring_integration_sources 0.0
# HELP jvm_threads_daemon_threads The current number of live daemon threads
# TYPE jvm_threads_daemon_threads gauge
jvm_threads_daemon_threads 69.0
# HELP tomcat_sessions_created_sessions_total
# TYPE tomcat_sessions_created_sessions_total counter
tomcat_sessions_created_sessions_total 0.0
# HELP tomcat_sessions_rejected_sessions_total
# TYPE tomcat_sessions_rejected_sessions_total counter
tomcat_sessions_rejected_sessions_total 0.0
# HELP jvm_gc_max_data_size_bytes Max size of old generation memory pool
# TYPE jvm_gc_max_data_size_bytes gauge
jvm_gc_max_data_size_bytes 2.845310976E9
# HELP process_cpu_usage The "recent cpu usage" for the Java Virtual Machine process
# TYPE process_cpu_usage gauge
process_cpu_usage 0.12716195672342906
# HELP jvm_buffer_memory_used_bytes An estimate of the memory that the Java virtual machine is using for this buffer pool
# TYPE jvm_buffer_memory_used_bytes gauge
jvm_buffer_memory_used_bytes{id="direct",} 16402.0
jvm_buffer_memory_used_bytes{id="mapped",} 0.0
# HELP tomcat_sessions_active_max_sessions
# TYPE tomcat_sessions_active_max_sessions gauge
tomcat_sessions_active_max_sessions 0.0
# HELP jvm_threads_live_threads The current number of live threads including both daemon and non-daemon threads
# TYPE jvm_threads_live_threads gauge
jvm_threads_live_threads 128.0
# HELP jvm_threads_peak_threads The peak live thread count since the Java virtual machine started or peak was reset
# TYPE jvm_threads_peak_threads gauge
jvm_threads_peak_threads 128.0
# HELP jvm_classes_unloaded_classes_total The total number of classes unloaded since the Java virtual machine has started execution
# TYPE jvm_classes_unloaded_classes_total counter
jvm_classes_unloaded_classes_total 0.0
# HELP system_cpu_usage The "recent cpu usage" for the whole system
# TYPE system_cpu_usage gauge
system_cpu_usage 0.08727740040389209
# HELP spring_integration_handlers The number of message handlers
# TYPE spring_integration_handlers gauge
spring_integration_handlers 1.0
# HELP process_uptime_seconds The uptime of the Java virtual machine
# TYPE process_uptime_seconds gauge
process_uptime_seconds 252.707
# HELP jvm_gc_pause_seconds Time spent in GC pause
# TYPE jvm_gc_pause_seconds summary
jvm_gc_pause_seconds_count{action="end of major GC",cause="Metadata GC Threshold",} 1.0
jvm_gc_pause_seconds_sum{action="end of major GC",cause="Metadata GC Threshold",} 0.24
jvm_gc_pause_seconds_count{action="end of minor GC",cause="Metadata GC Threshold",} 1.0
jvm_gc_pause_seconds_sum{action="end of minor GC",cause="Metadata GC Threshold",} 0.02
jvm_gc_pause_seconds_count{action="end of minor GC",cause="Allocation Failure",} 3.0
jvm_gc_pause_seconds_sum{action="end of minor GC",cause="Allocation Failure",} 0.047
jvm_gc_pause_seconds_count{action="end of minor GC",cause="GCLocker Initiated GC",} 1.0
jvm_gc_pause_seconds_sum{action="end of minor GC",cause="GCLocker Initiated GC",} 0.018
# HELP jvm_gc_pause_seconds_max Time spent in GC pause
# TYPE jvm_gc_pause_seconds_max gauge
jvm_gc_pause_seconds_max{action="end of major GC",cause="Metadata GC Threshold",} 0.0
jvm_gc_pause_seconds_max{action="end of minor GC",cause="Metadata GC Threshold",} 0.0
jvm_gc_pause_seconds_max{action="end of minor GC",cause="Allocation Failure",} 0.0
jvm_gc_pause_seconds_max{action="end of minor GC",cause="GCLocker Initiated GC",} 0.0
The final effect is shown in the figure below
3、 ... and 、 Problems encountered in practice
( One ) problem 1
You can see the following problem through the screenshot :
Above class TextFormat Medium Collector.Type.INFO Medium to low version simpleclient 0.5.0 There is no cause for this exception .
The reason for this : because spring-cloud-starter-alibaba-nacos-discovery It depends on 0.5.0 Version of simpleclient
Solution : Get rid of spring-cloud-starter-alibaba-nacos-discovery Low version in simpleclient that will do
边栏推荐
- Talk about multithreaded concurrent programming from a different perspective without heap concept
- Knowledge points of common interview questions: distributed lock
- Oracle advanced (XIV) explanation of escape characters
- 【论文阅读】Q-BERT: Hessian Based Ultra Low Precision Quantization of BERT
- [fortran]vscode configure FORTRAN to run Hello World
- Dimensionality reduction and mathematical modeling after reading blog!
- Tips of Day1 practice in 2022cuda summer training camp
- 12th generation core processor +2.8k OLED ASUS good screen, lingyao 142022 shadow cyan glaze business thin book
- 皕杰报表之文本附件属件
- [Yugong series] go teaching course 010 in July 2022 - Boolean and character types of data types
猜你喜欢
根据给定字符数和字符,打印输出“沙漏”和剩余数
[jetson][reprint]pycharm installed on Jetson
Yin Yi: my learning and growth path
跟着武老师学高数——函数、极限和连续(持续更新)
[ts]typescript learning record pit collection
MySQL infrastructure: SQL query statement execution process
This developer, who has been on the list for four consecutive weeks, has lived like a contemporary college student
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
Knowledge points of common interview questions: distributed lock
皕杰报表之文本附件属件
随机推荐
MySQL optimization theory study guide
leetcode刷题——排序
全面、详细的SQL学习指南(MySQL方向)
一文读懂Plato Farm的ePLATO,以及其高溢价缘由
[Yugong series] go teaching course 009 in July 2022 - floating point type of data type
英特尔联合Datawhale,发布学习项目!
[log frame]
这才是开发者神器正确的打开方式
This is the right way for developers to open artifacts
MySQL 8 of relational database -- deepening and comprehensive learning from the inside out
Notes for Resume Writing
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
MySQL million level data migration practice notes
My problem solving record 1: the @component annotation is used on the class. If you want to use the methods in this class, you can't directly new, but should use @autowired for injection, otherwise an
Several common design methods of test cases [easy to understand]
DW: optimize the training process of target detection and more comprehensive calculation of positive and negative weights | CVPR 2022
云服务大厂高管大变阵:技术派让位销售派
Google Earth engine (GEE) -- calculate the location of the center point, the external boundary, the external polygon, fuse and simplify the boundary and return it to the vector set
Summary of JD internship written examination questions
Summary of window system operation skills