Custom Metrics Monitor
#
ExplanationBefore custom development, please customize and build the gateway environment first, please refer to: custom deployment
This article describes how to customize the extension of
org.apache.shenyu.metrics.spi.MetricsBootService
.
#
Extension- Create a new class
${you class}
,implementsorg.apache.shenyu.metrics.spi.MetricsBootService
public class ${you class} implements MetricsBootService { /** * Start metrics tracker. * * @param metricsConfig metrics config * @param metricsRegister the metrics register */ public void start(MetricsConfig metricsConfig, MetricsRegister metricsRegister){ //your code } /** * Stop metrics tracker. */ public void stop() { //your code }}
- In the project
resources
directory,Create a newMETA-INF/shenyu
directory, and the new file name is :org.apache.shenyu.metrics.spi.MetricsBootService
. add${you spi name}
=${you class path}
:
${you spi name} = ${you class path}
- In the
Admin
service ---> BasicConfig ---> Plugin , Find theMonitor
plugin, edit config, pay attention to themetricsName
name:${you spi name}
.