beiwei30 closed pull request #1407: [Dubbo-1510] dubbo monitor missing 
parameters
URL: https://github.com/apache/incubator-dubbo/pull/1407
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java
 
b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java
index 9d51517ca5..835daedabc 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java
@@ -41,6 +41,8 @@
 
     private String version;
 
+    private String interval;
+
     // customized parameters
     private Map<String, String> parameters;
 
@@ -123,4 +125,12 @@ public void setDefault(Boolean isDefault) {
         this.isDefault = isDefault;
     }
 
+    public void setInterval(String interval){
+        this.interval = interval;
+    }
+
+    public String getInterval(){
+        return interval;
+    }
+
 }
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd 
b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
index 1ae252a880..e21b1a51db 100644
--- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
+++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
@@ -574,6 +574,11 @@
                 <xsd:documentation><![CDATA[ The monitor version. 
]]></xsd:documentation>
             </xsd:annotation>
         </xsd:attribute>
+        <xsd:attribute name="interval" type="xsd:string" use="optional">
+            <xsd:annotation>
+                <xsd:documentation><![CDATA[ The monitor interval. 
]]></xsd:documentation>
+            </xsd:annotation>
+        </xsd:attribute>
         <xsd:attribute name="default" type="xsd:string" use="optional">
             <xsd:annotation>
                 <xsd:documentation><![CDATA[ Is default. 
]]></xsd:documentation>
diff --git 
a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/support/MonitorFilter.java
 
b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/support/MonitorFilter.java
index ebeb4ee8aa..679b25cd51 100644
--- 
a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/support/MonitorFilter.java
+++ 
b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/support/MonitorFilter.java
@@ -84,6 +84,8 @@ private void collect(Invoker<?> invoker, Invocation 
invocation, Result result, S
             String application = 
invoker.getUrl().getParameter(Constants.APPLICATION_KEY);
             String service = invoker.getInterface().getName(); // service name
             String method = RpcUtils.getMethodName(invocation); // method name
+            String group = invoker.getUrl().getParameter(Constants.GROUP_KEY);
+            String version = 
invoker.getUrl().getParameter(Constants.VERSION_KEY);
             URL url = invoker.getUrl().getUrlParameter(Constants.MONITOR_KEY);
             Monitor monitor = monitorFactory.getMonitor(url);
             if (monitor == null) {
@@ -121,7 +123,9 @@ private void collect(Invoker<?> invoker, Invocation 
invocation, Result result, S
                     MonitorService.ELAPSED, String.valueOf(elapsed),
                     MonitorService.CONCURRENT, String.valueOf(concurrent),
                     Constants.INPUT_KEY, input,
-                    Constants.OUTPUT_KEY, output));
+                    Constants.OUTPUT_KEY, output,
+                    Constants.GROUP_KEY, group,
+                    Constants.VERSION_KEY, version));
         } catch (Throwable t) {
             logger.error("Failed to monitor count service " + invoker.getUrl() 
+ ", cause: " + t.getMessage(), t);
         }
diff --git 
a/dubbo-monitor/dubbo-monitor-default/src/main/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitor.java
 
b/dubbo-monitor/dubbo-monitor-default/src/main/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitor.java
index 7393afed1a..b320492bd4 100644
--- 
a/dubbo-monitor/dubbo-monitor-default/src/main/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitor.java
+++ 
b/dubbo-monitor/dubbo-monitor-default/src/main/java/com/alibaba/dubbo/monitor/dubbo/DubboMonitor.java
@@ -16,6 +16,7 @@
  */
 package com.alibaba.dubbo.monitor.dubbo;
 
+import com.alibaba.dubbo.common.Constants;
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.common.logger.Logger;
 import com.alibaba.dubbo.common.logger.LoggerFactory;
@@ -92,6 +93,7 @@ public void send() {
             long maxOutput = numbers[7];
             long maxElapsed = numbers[8];
             long maxConcurrent = numbers[9];
+            String version = getUrl().getParameter(Constants.DEFAULT_PROTOCOL);
 
             // send statistics data
             URL url = statistics.getUrl()
@@ -105,7 +107,8 @@ public void send() {
                             MonitorService.MAX_INPUT, String.valueOf(maxInput),
                             MonitorService.MAX_OUTPUT, 
String.valueOf(maxOutput),
                             MonitorService.MAX_ELAPSED, 
String.valueOf(maxElapsed),
-                            MonitorService.MAX_CONCURRENT, 
String.valueOf(maxConcurrent)
+                            MonitorService.MAX_CONCURRENT, 
String.valueOf(maxConcurrent),
+                            Constants.DEFAULT_PROTOCOL, version
                     );
             monitorService.collect(url);
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to