Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add debug log of the measurement result details. #121

Merged
merged 32 commits into from
May 16, 2018

Conversation

NeGnail
Copy link
Contributor

@NeGnail NeGnail commented May 15, 2018

Motivation:

Print the measurement result details for each time window.For example:

[testApp]measure info: service[com.alipay.sofa.rpc.client.aft.bean.FaultHelloService];stats{127.0.0.1};details{timeWindow[3];leastWindowCount[10];averageExceptionRate[0.2];leastWindowExceptionRateMultiple[1.0];detail[(ip:127.0.0.1,abnormalRate:0.2,invocationLeastWindowCount:10,measureState:ABNORMAL)]

Modification:

add method ‘com.alipay.sofa.rpc.client.aft.impl.ServiceHorizontalMeasureStrategy#logMeasureResult’

Result:

Fixes #109 .

@NeGnail NeGnail changed the title Atf log Print the measurement result details for each time window. May 15, 2018
@codecov-io
Copy link

codecov-io commented May 15, 2018

Codecov Report

Merging #121 into master will increase coverage by 0.12%.
The diff coverage is 87.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #121      +/-   ##
============================================
+ Coverage     65.01%   65.14%   +0.12%     
- Complexity      646      652       +6     
============================================
  Files           271      271              
  Lines         11587    11618      +31     
  Branches       1953     1957       +4     
============================================
+ Hits           7533     7568      +35     
+ Misses         3082     3080       -2     
+ Partials        972      970       -2
Impacted Files Coverage Δ Complexity Δ
...ent/aft/impl/ServiceHorizontalMeasureStrategy.java 84.44% <87.09%> (+0.79%) 26 <4> (+4) ⬆️
.../alipay/sofa/rpc/registry/local/LocalRegistry.java 57.83% <0%> (+0.6%) 26% <0%> (+1%) ⬆️
...alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java 57.08% <0%> (+0.78%) 0% <0%> (ø) ⬇️
...ava/com/alipay/sofa/rpc/config/RegistryConfig.java 36% <0%> (+1%) 0% <0%> (ø) ⬇️
...a/com/alipay/sofa/rpc/client/aft/MeasureModel.java 47.82% <0%> (+4.34%) 6% <0%> (+1%) ⬆️
...pay/sofa/rpc/transport/ClientTransportFactory.java 63.63% <0%> (+4.54%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b9feae...f7220ca. Read the comment docs.

List<InvocationStat> stats = measureModel.getInvocationStats();
List<MeasureResultDetail> details = measureResult.getAllMeasureResultDetails();

if (!LOGGER.isInfoEnabled(appName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果这里提前返回的话,把这个移到最前面去。

info.append(",");
}
if (stats.size() > 0) {
info = new StringBuilder(info.substring(0, info.lastIndexOf(",")));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是要删最后一个字符吗? 直接 info.deleteCharAt(info.length()-1)


public static void main(String[] args) {
new ServiceHorizontalMeasureStrategy().logMeasureResult(null, 0, 0, 0, 0);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删掉main() 方法

@ujjboy ujjboy merged commit def547f into sofastack:master May 16, 2018
@ujjboy ujjboy added this to the 5.4.0 milestone May 16, 2018
@ujjboy ujjboy added the optimization Code optimization label May 16, 2018
@ujjboy ujjboy changed the title Print the measurement result details for each time window. Add debug log of the measurement result details. May 16, 2018
@NeGnail NeGnail deleted the atf_log branch May 16, 2018 05:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
optimization Code optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants