[ 
https://issues.apache.org/jira/browse/TS-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13599640#comment-13599640
 ] 

ASF subversion and git services commented on TS-1740:
-----------------------------------------------------

Commit 5bcc19e6e901e7115bfbbcc6b4b8f60dfc51f4a7 in branch refs/heads/master 
from Zhao Yongming <[email protected]>
[ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=5bcc19e ]

TS-1740: Improve precision of stats values

Conversion between types, such as RecInt(int64_t) to RecFloat(float),
may lead to loss of precision.

In the old code, token value was defined with StatFloat type, it would casue
unnecessary conversion when type of token is not StatFloat.

it's best to keep value with the same type of token as much as possiable.

Signed-off-by: Yunkai Zhang <[email protected]>
Signed-off-by: Zhao Yongming <[email protected]>

                
> Improve precision of stats's values
> -----------------------------------
>
>                 Key: TS-1740
>                 URL: https://issues.apache.org/jira/browse/TS-1740
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Stats
>            Reporter: Yunkai Zhang
>         Attachments: 0001-Improve-precision-of-stats-s-values.patch
>
>
> Improve precision of stats's values
> Conversion between types, such as RecInt(int64_t) to RecFloat(float),
> may lead to loss of precision.
> In the old code, token value was defined with StatFloat type, it would casue
> unnecessary conversion when type of token is not StatFloat.
> it's best to keep value with the same type of token as much as possiable.
> ===
> For example, we have defined such expression in stats.config.xml:
> {code}
>     <statistics>
>         
> <destination>proxy.node.http.user_agent_total_request_bytes</destination>
>         <destination 
> scope="cluster">proxy.cluster.http.user_agent_total_request_bytes</destination>
>        <expression>
>             proxy.process.http.user_agent_request_document_total_size +
>             proxy.process.http.user_agent_request_header_total_size
>         </expression>
>     </statistics>
> {code}
> So:
> proxy.node.http.user_agent_total_request_bytes = \
>       proxy.process.http.user_agent_request_document_total_size + \
>       proxy.process.http.user_agent_request_header_total_size
> These three stats token are all RecInt types, but the code would convert them 
> to RecFloat when evaluating the expression, like that:
> proxy.node.http.user_agent_total_request_bytes = \
>       (RecFloat)proxy.process.http.user_agent_request_document_total_size + \
>       (RecFloat)proxy.process.http.user_agent_request_header_total_size
> As a result, we might get the following output from stats http API:
> {code}
> [root@test62 trafficserver]# cat ~/bin/list-cluster.sh 
> elinks -dump http://localhost:8080/stat/ | grep proxy_name
> elinks -dump http://localhost:8080/stat/ | grep nodes
> elinks -dump http://localhost:8080/stat/ | grep 
> proxy.process.http.origin_server_request_document_total_size
> elinks -dump http://localhost:8080/stat/ | grep 
> proxy.process.http.origin_server_request_header_total_size
> elinks -dump http://localhost:8080/stat/ | grep 
> proxy.node.http.origin_server_total_request_bytes
> [root@test62 trafficserver]# list-cluster.sh 
>  proxy.config.proxy_name=test62.63
>  proxy.node.cluster.nodes=1
>  proxy.process.cluster.nodes=1
>  proxy.process.http.origin_server_request_document_total_size=0        <= #1
>  proxy.process.http.origin_server_request_header_total_size=359209123  <= #2
>  proxy.node.http.origin_server_total_request_bytes=359209120           <= #3 
> != (#1 + #2)
> {code}
> As the value increasing, the loss of precision will become more and more 
> seriously. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to