监控中心扩展
扩展说明
负责监控服务调用次数和调用时间。
扩展端口
org.apache.dubbo.monitor.MonitorFactory
org.apache.dubbo.monitor.Monitor
扩展配置
<!-- Define the monitoring center -->
<dubbo:monitor address="xxx://ip:port" />
已知扩展
org.apache.dubbo.monitor.support.dubbo.DubboMonitorFactory
扩展示例
Maven 项目结构
src
|-main
|-java
|-com
|-xxx
|-XxxMonitorFactoryjava (implement the MonitorFactory interface)
|-XxxMonitor.java (implement Monitor interface)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.monitor.MonitorFactory (plain text file, content: xxx=com.xxx.XxxMonitorFactory)
XxxMonitorFactory.java
package com.xxx;
import org.apache.dubbo.monitor.MonitorFactory;
import org.apache.dubbo.monitor.Monitor;
import org.apache.dubbo.common.URL;
public class XxxMonitorFactory implements MonitorFactory {
public Monitor getMonitor(URL url) {
return new XxxMonitor(url);
}
}
XxxMonitor.java
package com.xxx;
import org.apache.dubbo.monitor.Monitor;
public class XxxMonitor implements Monitor {
public void count(URL statistics) {
//...
}
}
META-INF/dubbo/org.apache.dubbo.monitor.MonitorFactory
xxx=com.xxx.XxxMonitorFactory
上次修改时间:2023 年 1 月 2 日: 增强英文文档 (#1798) (95a9f4f6c1c)