Skip to main content
Version: v1.6.x

Monitoring:Apache ShenYu API Gateway

monitor ShenYu running status(JVM-related), include request response and other related metrics.

Pre-monitoring operations

Enable metrics plugin in ShenYu, expose it's prometheus metrics endpoint。

Refer ShenYu Document

Two Steps Mainly:

  1. add metrics plugin dependency in gateway's pom.xml.

    <dependency>
    <groupId>org.apache.shenyu</groupId>
    <artifactId>shenyu-spring-boot-starter-plugin-metrics</artifactId>
    <version>${project.version}</version>
    </dependency>
  2. modify this config in shenyu gateway yaml.

    shenyu:
    metrics:
    enabled: false #false is close, true is open
    name : prometheus
    host: 127.0.0.1
    port: 8090
    jmxConfig:
    props:
    jvm_enabled: true #enable jvm monitoring

Finally, restart the access gateway metrics endpoint http://ip:8090 to respond to prometheus format data.

Configuration parameters

Parameter nameParameter help description
Monitoring HostThe peer IPV4, IPV6 or domain name to be monitored. Note ⚠️Without protocol header (eg: https://, http://).
Monitoring nameThe name that identifies this monitoring, and the name needs to be unique.
PortThe port provided by the gateway Metric interface, the default is 8090.
TimeoutHTTP request response timeout
Acquisition IntervalInterval time for monitoring periodic data collection, in seconds, the minimum interval that can be set is 30 seconds
Whether to detectWhether to detect and check the availability of monitoring before adding monitoring, and the operation of adding and modifying will continue after the detection is successful
Description RemarksMore remark information to identify and describe this monitoring, users can remark information here

Collect metrics

Index collection: shenyu_request_total

Metric NameMetric UnitMetric Help Description
valueNoneCollect all requests from ShenYu gateway

Metric collection: shenyu_request_throw_created

Metric NameMetric UnitMetric Help Description
valueNoneCollect the number of abnormal requests from ShenYu Gateway

Metric collection: process_cpu_seconds_total

Metric NameMetric UnitMetric Help Description
valuenonetotal user and system CPU elapsed seconds

Metric collection: process_open_fds

Metric NameMetric UnitMetric Help Description
valuenonenumber of open file descriptors

Metric collection: process_max_fds

Metric NameMetric UnitMetric Help Description
valuenonemaximum number of open file descriptors

Metric collection: jvm_info

Metric NameMetric UnitMetric Help Description
runtimenoneJVM version information
vendornoneJVM version information
versionNoneJVM version information

Metric collection: jvm_memory_bytes_used

Metric NameMetric UnitMetric Help Description
areaNoneJVM memory area
valueMBused size of the given JVM memory region

Metric collection: jvm_memory_pool_bytes_used

Metric NameMetric UnitMetric Help Description
poolNoneJVM memory pool
valueMBused size of the given JVM memory pool

Metric collection: jvm_memory_pool_bytes_committed

Metric NameMetric UnitMetric Help Description
poolNoneJVM memory pool
valueMBThe committed size of the given JVM memory pool

Metric collection: jvm_memory_pool_bytes_max

Metric NameMetric UnitMetric Help Description
poolNoneJVM memory pool
valueMBThe maximum size of the memory pool for the given JVM

Metric collection: jvm_threads_state

Metric NameMetric UnitMetric Help Description
statenonethread state
valueNoneThe number of threads corresponding to the thread state