Projects tigase _server server-core Issues #1245
MethodStatistics doesn't work well for interfaces with overloaded methods (#1245)
wojciech.kapcia@tigase.net opened 4 years ago

Currently MethodStatistics maintains collection of methods ( private final ConcurrentHashMap<Method, MethodStatistics> statistics = new ConcurrentHashMap<>(); ) and propagates it correctly (https://github.com/tigase/tigase-server/blob/05fa90bfa40ad4b253819b4be7b897fd76b7c8b2/src/main/java/tigase/stats/StatisticsInvocationHandler.java#L46-L46 ) but during actual statistics collection overloaded methods are not correctly distinguished causing some statistics to be "dropped" (by being overridden) in https://github.com/tigase/tigase-server/blob/05fa90bfa40ad4b253819b4be7b897fd76b7c8b2/src/main/java/tigase/stats/StatisticsInvocationHandler.java#L138-L138 where we simply take method name (String name = method.getName(); ) and add it to the list: list.add(compName, prefix + "/" + name + "/Excutions last hour", per_hour, Level.FINEST);

The most notable example would be UserRepository and it's getData method:

stats_1618097587611_2021-04-10_23:33:07.txt:userRepository/default/getData/Excutions last hour  0
stats_1618097587611_2021-04-10_23:33:07.txt:userRepository/default/getData/Excutions last minute        0
stats_1618097587611_2021-04-10_23:33:07.txt:userRepository/default/getData/Excutions last second        0
stats_1618097587611_2021-04-10_23:33:07.txt:userRepository/default/getData/Average processing time      149
stats_1618097587611_2021-04-10_23:33:07.txt:userRepository/default/getData/Executions   4806881
stats_1618097587611_2021-04-10_23:33:07.txt:userRepository/default/getData/Exceptions during execution  383
stats_1618097650957_2021-04-10_23:34:10.txt:userRepository/default/getData/Excutions last hour  0
stats_1618097650957_2021-04-10_23:34:10.txt:userRepository/default/getData/Excutions last minute        0
stats_1618097650957_2021-04-10_23:34:10.txt:userRepository/default/getData/Excutions last second        0
stats_1618097650957_2021-04-10_23:34:10.txt:userRepository/default/getData/Average processing time      1785
stats_1618097650957_2021-04-10_23:34:10.txt:userRepository/default/getData/Executions   4812054
stats_1618097650957_2021-04-10_23:34:10.txt:userRepository/default/getData/Exceptions during execution  383
stats_1618097710957_2021-04-10_23:35:10.txt:userRepository/default/getData/Excutions last hour  0
stats_1618097710957_2021-04-10_23:35:10.txt:userRepository/default/getData/Excutions last minute        0
stats_1618097710957_2021-04-10_23:35:10.txt:userRepository/default/getData/Excutions last second        0
stats_1618097710957_2021-04-10_23:35:10.txt:userRepository/default/getData/Average processing time      1057
stats_1618097710957_2021-04-10_23:35:10.txt:userRepository/default/getData/Executions   4820019
stats_1618097710957_2021-04-10_23:35:10.txt:userRepository/default/getData/Exceptions during execution  383
stats_1618097770957_2021-04-10_23:36:10.txt:userRepository/default/getData/Excutions last hour  0
stats_1618097770957_2021-04-10_23:36:10.txt:userRepository/default/getData/Excutions last minute        0
stats_1618097770957_2021-04-10_23:36:10.txt:userRepository/default/getData/Excutions last second        0
stats_1618097770957_2021-04-10_23:36:10.txt:userRepository/default/getData/Average processing time      421
stats_1618097770957_2021-04-10_23:36:10.txt:userRepository/default/getData/Executions   4826272
stats_1618097770957_2021-04-10_23:36:10.txt:userRepository/default/getData/Exceptions during execution  383
stats_1618097830957_2021-04-10_23:37:10.txt:userRepository/default/getData/Excutions last hour  0
stats_1618097830957_2021-04-10_23:37:10.txt:userRepository/default/getData/Excutions last minute        0
stats_1618097830957_2021-04-10_23:37:10.txt:userRepository/default/getData/Excutions last second        0
stats_1618097830957_2021-04-10_23:37:10.txt:userRepository/default/getData/Average processing time      2208
stats_1618097830957_2021-04-10_23:37:10.txt:userRepository/default/getData/Executions   4832601
stats_1618097830957_2021-04-10_23:37:10.txt:userRepository/default/getData/Exceptions during execution  383
stats_1618097890957_2021-04-10_23:38:10.txt:userRepository/default/getData/Excutions last hour  0
stats_1618097890957_2021-04-10_23:38:10.txt:userRepository/default/getData/Excutions last minute        2
stats_1618097890957_2021-04-10_23:38:10.txt:userRepository/default/getData/Excutions last second        0
stats_1618097890957_2021-04-10_23:38:10.txt:userRepository/default/getData/Average processing time      304
stats_1618097890957_2021-04-10_23:38:10.txt:userRepository/default/getData/Executions   4837847
stats_1618097890957_2021-04-10_23:38:10.txt:userRepository/default/getData/Exceptions during execution  383

We have increasing count of executions yet calculation of "Execution last X" is completely wrong.

Possible solution would be to include all method parameters in the statistics list (e.g.: getData(String), getData(BareJID,String), etc.)

issue 1 of 1
Type
Task
Priority
Normal
Assignee
Version
tigase-server-8.2.0
Spent time
45m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1245
Please wait...
Page is in error, reload to recover