-
Notifications
You must be signed in to change notification settings - Fork 26.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MetricsFilter implements BaseFilter.Listener #10589
Conversation
@@ -48,38 +49,21 @@ public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcExcept | |||
if (collector == null || !collector.isCollectEnabled()) { | |||
return invoker.invoke(invocation); | |||
} | |||
MetricsCollectExecutor collectorExecutor = new MetricsCollectExecutor(collector, invocation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of code appears in multiple places, can you extract it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理
private String version; | ||
|
||
|
||
private static final String METRIC_FILTER_START_TIME = "metric_filter_start_time"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of code can be placed in src/main/java/org/apache/dubbo/common/constants/MetricsConstants.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理
Result result = filter.invoke(invoker, invocation); | ||
|
||
filter.onResponse(result, invoker, invocation); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to use format checking to remove extra blank lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理
@@ -0,0 +1,82 @@ | |||
package org.apache.dubbo.metrics.filter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apache's open source protocol should be copy-pasted in the file header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理
if (throwable instanceof RpcException) { | ||
collector.increaseFailedRequests(interfaceName, methodName, group, version); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要处理非 RpcException 的情况,通过 onError 过来的基本都是框架异常
onResponse 是业务正常返回(包括业务正常返回、业务抛异常返回),这里可能需要独立判断采集下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是否可以这样理解为,在非rpc异常的情况下,不需要统计rt时间
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理
Codecov Report
@@ Coverage Diff @@
## 3.1 #10589 +/- ##
============================================
+ Coverage 64.76% 64.84% +0.08%
- Complexity 397 414 +17
============================================
Files 1331 1334 +3
Lines 56564 56667 +103
Branches 8377 8378 +1
============================================
+ Hits 36632 36747 +115
+ Misses 15987 15984 -3
+ Partials 3945 3936 -9
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
#10554