Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

API_Statistics.py displays empty headings outside start date and time #669

Open
thanh-lam opened this issue May 6, 2019 · 0 comments
Open

Comments

@thanh-lam
Copy link
Member

Describe the bug
When API_Statistics.py is run with -s or --start date time, like -s "2019-05-03 10:02:30.029198", it also displays empty headings for logs before that date and time. Here, the user only expects to see the logs starting from --start date time.

To Reproduce
Steps to reproduce the behavior:

  1. Login to master node, f4n05.
  2. Change dir. to /opt/ibm/csm/tools/.
  3. Run python ./API_Statistics to see all logs of all dates and times. Copy a date and time from the displayed output.
  4. Run python ./API_Statistics -s "2019-05-03 10:02:30.029198" (Or, a recent date and time that exclude older logs).
  5. Scroll back to see many of the empty heading.

Expected behavior
When the user run API_Statistics.py with starting date and time, he only expects to see logs for that time period. The script should not display empty headings with no log info.

Screenshots

# python ./API_Statistics.py -s "2019-05-03 10:02:30.029198"
...
+++++++++++++++++++++++++++++++++++++++++++++++++++++Master Log++++++++++++++++++++++++++++++++++++++++++++++++++++
---------------------------------------/var/log/ibm/csm/csm_master.log.old.2---------------------------------------
------------------File Start: 2019-04-30 09:34:58.029334 and File End: 2019-05-02 14:12:55.003402------------------
+++++++++++++++++++++++++++++++++++++++++++++++++++++Master Log++++++++++++++++++++++++++++++++++++++++++++++++++++
Api Function                                       Frequency   Mean      Median    Min       Max       Std     
---------------------------------------/var/log/ibm/csm/csm_master.log.old.3---------------------------------------
Total Calls:  0
Total Errors: 0

Run Time: 0.0182750225067

------------------File Start: 2019-04-26 14:43:38.118020 and File End: 2019-04-30 09:34:58.004686------------------
Api Function                                       Frequency   Mean      Median    Min       Max       Std     
Total Calls:  0
Total Errors: 0

Run Time: 0.0244190692902

Environment (please complete the following information):

  • Machine [IST alt. cluster, master node f4n05]
  • Version [CSM 1.6.0]

Additional context
The script does display the logs starting from the date and time specified:

+++++++++++++++++++++++++++++++++++++++++++++++++++++Master Log++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------------/var/log/ibm/csm/csm_master.log------------------------------------------
------------------File Start: 2019-05-03 10:02:30.029198 and File End: 2019-05-06 14:30:27.101689------------------
Api Function                                       Frequency   Mean      Median    Min       Max       Std     
csm_allocation_create                                       3  71.560633  64.772258  30.512325  119.397316  36.603251
csm_allocation_delete                                       3  30.297511  30.298023  30.296326  30.298185  0.000841
csm_ib_cable_inventory_collection                           1  0.041657  0.041657  0.041657  0.041657  0.000000
csm_node_attributes_update                                  3  0.018793  0.020028  0.015939  0.020411  0.002024
csm_node_resources_query_all                             7882  0.002392  0.002376  0.001272  0.007249  0.000197
csm_switch_children_inventory_collection                    1  0.016226  0.016226  0.016226  0.016226  0.000000
csm_switch_inventory_collection                             1  0.006728  0.006728  0.006728  0.006728  0.000000
Total Calls:  7894
Total Errors: 0

Run Time: 0.68452000618

Issue Source:
In IST environments, we accumulated lots of old logs so this script may help with showing just the logs we want to see.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants