Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-1631

Clear Stats doesn't work - old value return

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.3.2
    • Management API, Metrics
    • None

    Description

      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.

      Attachments

        1. clear_stats_ver_1.diff
          21 kB
          Yakov Kopel
        2. clear_stats_ver_2.diff
          21 kB
          Yakov Kopel
        3. clear_stats_ver_3.diff
          21 kB
          Yakov Kopel

        Issue Links

          Activity

            People

              zwoop Leif Hedstrom
              kopely Yakov Kopel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: