Yakov Kopel created TS-1631:
-------------------------------

             Summary: Clear Stats doesn't work - old value return
                 Key: TS-1631
                 URL: https://issues.apache.org/jira/browse/TS-1631
             Project: Traffic Server
          Issue Type: Bug
          Components: Core, Management API
            Reporter: Yakov Kopel



I’m trying to clear stats using traffic_line -c/-C and it doesn’t appear to 
work. After a couple of seconds the old values return.

CLI sample output:
    traffic_line -r proxy.process.http.total_client_connections_ipv4
    208
    traffic_line -c
    traffic_line -r proxy.process.http.total_client_connections_ipv4
    0
    traffic_line -r proxy.process.http.total_client_connections_ipv4
    210

I think this is due to not updating the sum/count in the net-threads. 
When traffic_line -c/-C is called - it clear the records table but not the 
net-threads sum/count variables.
In the next time the RecRawStatSyncCount func will be called it will override 
the "zero" value in the records table.

For example - http_total_client_connections_ipv4_stat

  1. This stat is used in proxy/http/HttpClientSession.cc
  2. The macro HTTP_INCREMENT_DYN_STAT using the RecIncrRawStat func to 
increament the stat value.
  3. The RecIncrRawStat increament the sum counter on the specific net thread.
  4. RecRawStatSyncCount is called in a loop and summarize all the stats in the 
net thread to one global value.
  5. RecRegisterRawStatSyncCb is called to update the global value in the 
records table.
  
I'm attaching a patch to fix it.

1. add -z/-Z otipns to traffic_line - to reset specific stat.
2. I added a version variable to the record of the stat - so that if we want to 
reset a record - we will increase this record.
3. On the next sync to global call (RecExecRawStatSyncCbs in RecProcess.cc) it 
will clear the sum/counter in the net-tread variables.

There is another issue about the RecDecrRawStat function - I'll open on it 
another Jira. 

Regards,
Yakov Kopel.


--
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