spring-boot-starter-undertow
组件简介
将 Undertow 容器嵌入到 Spring Boot
使用说明
1、Spring Boot 项目添加 Maven 依赖
<!-- For Embed Undertow -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
2、集成 Prometheus 监控
项目中引入 micrometer-prometheus 依赖,可实现 Undertow
容器的指标采集
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>com.github.hiwepy</groupId>
<artifactId>undertow-metrics-prometheus</artifactId>
</dependency>
可采集到如下指标:
# HELP undertow_request_time_max_seconds The longest request duration in time
# TYPE undertow_request_time_max_seconds gauge
undertow_request_time_max_seconds{application="app-test",} NaN
# HELP undertow_request_count_seconds Number of requests
# TYPE undertow_request_count_seconds summary
undertow_request_count_seconds_count{application="app-test",} 0.0
undertow_request_count_seconds_sum{application="app-test",} 0.0
# HELP undertow_request_errors_total Total number of error requests
# TYPE undertow_request_errors_total counter
undertow_request_errors_total{application="app-test",} 0.0
# HELP undertow_request_time_min_seconds The shortest request duration in time
# TYPE undertow_request_time_min_seconds gauge
undertow_request_time_min_seconds{application="app-test",} NaN
# HELP undertow_connectors_requests_active_connections
# TYPE undertow_connectors_requests_active_connections gauge
undertow_connectors_requests_active_connections{application="app-test",protocol="http",} 0.0
# HELP undertow_connectors_bytes_sent_bytes
# TYPE undertow_connectors_bytes_sent_bytes gauge
undertow_connectors_bytes_sent_bytes{application="app-test",protocol="http",} 725662.0
# HELP undertow_connectors_bytes_received_bytes
# TYPE undertow_connectors_bytes_received_bytes gauge
undertow_connectors_bytes_received_bytes{application="app-test",protocol="http",} 28790.0
# HELP undertow_connectors_connections_active_connections
# TYPE undertow_connectors_connections_active_connections gauge
undertow_connectors_connections_active_connections{application="app-test",protocol="http",} 5.0
# HELP undertow_connectors_processing_time_ms
# TYPE undertow_connectors_processing_time_ms gauge
undertow_connectors_processing_time_ms{application="app-test",protocol="http",} 0.0
# HELP undertow_connectors_requests_error_count
# TYPE undertow_connectors_requests_error_count gauge
undertow_connectors_requests_error_count{application="app-test",protocol="http",} 0.0
# HELP undertow_connectors_requests_count
# TYPE undertow_connectors_requests_count gauge
undertow_connectors_requests_count{application="app-test",protocol="http",} 64.0
# HELP undertow_connectors_processing_time_max_ms
# TYPE undertow_connectors_processing_time_max_ms gauge
undertow_connectors_processing_time_max_ms{application="app-test",protocol="http",} 0.0
# HELP undertow_connectors_requests_active_max_connections
# TYPE undertow_connectors_requests_active_max_connections gauge
undertow_connectors_requests_active_max_connections{application="app-test",protocol="http",} 6.0
# HELP undertow_connectors_connections_active_max_connections
# TYPE undertow_connectors_connections_active_max_connections gauge
undertow_connectors_connections_active_max_connections{application="app-test",protocol="http",} 8.0
# HELP undertow_sessions_rejected_sessions_total
# TYPE undertow_sessions_rejected_sessions_total counter
undertow_sessions_rejected_sessions_total{application="app-test",} 0.0
# HELP undertow_sessions_alive_max_seconds
# TYPE undertow_sessions_alive_max_seconds gauge
undertow_sessions_alive_max_seconds{application="app-test",} 0.0
# HELP undertow_sessions_active_max_sessions
# TYPE undertow_sessions_active_max_sessions gauge
undertow_sessions_active_max_sessions{application="app-test",} -1.0
# HELP undertow_sessions_active_current_sessions
# TYPE undertow_sessions_active_current_sessions gauge
undertow_sessions_active_current_sessions{application="app-test",} 0.0
# HELP undertow_sessions_created_sessions_total
# TYPE undertow_sessions_created_sessions_total counter
undertow_sessions_created_sessions_total{application="app-test",} 0.0
# HELP undertow_sessions_expired_sessions_total
# TYPE undertow_sessions_expired_sessions_total counter
undertow_sessions_expired_sessions_total{application="app-test",} 0.0
# HELP undertow_xwork_worker_pool_size XWork worker pool size
# TYPE undertow_xwork_worker_pool_size gauge
undertow_xwork_worker_pool_size{application="app-test",name="XNIO-2",} 6.0
# HELP undertow_xwork_worker_queue_size XWork worker queue size
# TYPE undertow_xwork_worker_queue_size gauge
undertow_xwork_worker_queue_size{application="app-test",name="XNIO-2",} 0.0
# HELP undertow_xwork_worker_pool_core_size XWork core worker pool size
# TYPE undertow_xwork_worker_pool_core_size gauge
undertow_xwork_worker_pool_core_size{application="app-test",name="XNIO-2",} 8.0
# HELP undertow_xwork_io_thread_count XWork io thread count
# TYPE undertow_xwork_io_thread_count gauge
undertow_xwork_io_thread_count{application="app-test",name="XNIO-2",} 2.0
# HELP undertow_xwork_worker_thread_busy_count XWork busy worker thread count
# TYPE undertow_xwork_worker_thread_busy_count gauge
undertow_xwork_worker_thread_busy_count{application="app-test",name="XNIO-2",} -1.0
# HELP undertow_xwork_worker_pool_max_size XWork max worker pool size
# TYPE undertow_xwork_worker_pool_max_size gauge
undertow_xwork_worker_pool_max_size{application="app-test",name="XNIO-2",} 8.0
作者:Jeebiz 创建时间:2023-05-05 17:02
最后编辑:Jeebiz 更新时间:2024-10-05 00:01
最后编辑:Jeebiz 更新时间:2024-10-05 00:01