Flow Diagram
Make even tracking in soul gateway by asynchronous or synchronous mode.
The prometheus
server pulls metrics' through http request, and then displays it by Grafana
.
soul-admin
--> plugin management-> monitor, set to enable.{"metricsName":"prometheus","host":"localhost","port":"9191","async":"true"} # port : Pulled ports for exposing to prometheus service. # host : If not filled in, it is the host of soul Gateway. # async :"true" is asynchronous event tracking, false is synchronous event tracking.
monitor
dependency in the pom.xml file of the gateway.<!-- soul monitor plugin start--> <dependency> <groupId>org.dromara</groupId> <artifactId>soul-spring-boot-starter-plugin-monitor</artifactId> <version>${last.version}</version> </dependency> <!-- soul monitor plugin end-->
All JVM,thread,memory,and other related infomation will be made event tracking,you can add a JVM module in the Granfana' panel, and it will be fully displayed, please refer to: https://github.com/prometheus/jmx_exporter
There are also the following custom metrics
Name | type | target | description |
---|---|---|---|
request_total | Counter | none | collecting all requests of Soul Gateway |
http_request_total | Counter | path,type | collecting all matched requests of monitor |
Users need to install Prometheus
service to collect
prometheus.yml
scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9190']
Note: The job_name
corresponds to the metricsName
of the monitor
plug-in configuration
prometheus.exe
in the window to start. The default boot port is 9090
, Success can be verified at http://localhost:9090/It is recommended to use Grafana
, Users can customize the query to personalize the display panel.
Here's how to install and deploy Grafana for Windows
download Unzip it and enter the bin
directory and double-click
grafana-server.exe
to run it. Go to http://localhost:3000/?orgId=1 admin/admin
to verify the success
Click Create
- Import
and enter the dashboards ID (8563 recommended).
The final JVM monitor panel looks like this:
request_total
、http_request_total
Click Create
- Import
and enter the panel config json
The final custom HTTP request monitoring panel looks like this: