.. system_metrics_commands_api:

Report API Commands
-------------------

.. index:: voss;voss report api

.. _19.1.1|VOSS-489:


.. important::

   On a Modular Architecture deployment, ``voss`` system specific commands
   can only be run on application nodes and for Unified and Single Node architectures, *not* on database or web proxy type nodes.
  


VOSS Automate provides a set of utilities available to provide API request metrics.
The commands are typically used to inspect and monitor API request performance
over a defined period.


Profile
.......

A command is available that aggregates the API requests performed during a given
date-time range by grouping them by model type and sorting them by duration.

The command and parameters are:

* **voss report api profile [OPTIONS] START_TIME END_TIME**
* ``START_TIME`` - The date-time value from which to start the sample collection.
* ``END_TIME`` - The date-time value from which to start the sample collection.
  Valid formats: `'%Y-%m-%d_%H:%M:%S', '%Y-%m-%d_%H:%M', '%Y-%m-%d'`
* Options:
  
  * ``--path TEXT`` API log file path (default is ``nginx/access.log``)
  * ``--limit INTEGER``  Limits the number of profile lines to display.
    If limited, the last row is listed as ``Other``


The command output shows Request_URI count data in columns.

Column headers:

* **90th-PCTL**: 90th percentile time value of the count
* **CV**: Coefficient of variation of the count 


Example:

::

   platform@VOSS:~$ voss report api profile --limit 6 2019-05-06_15:49 2019-05-06_16:00
        Count       TotalTime	AverageTime	 Percentage	 90th-PCTL	        CV               Method  Request-URI
          435          199.97	       0.46	     72.11%	      0.69	    34.66%                  PUT  /api/data/DataModel
           69           64.92	       0.94	     23.41%	      1.32	    29.76%                 LIST  /api/data/DataModel
           44           10.94	       0.25	      3.95%	      0.33	    38.26%                 LIST  /api/data/Migration
            1            0.12	       0.12	      0.04%	      0.00	     0.00%                 LIST  /api/data/Cuccx
            1            0.09	       0.09	      0.03%	      0.00	     0.00%                 LIST  /api/data/Smtp
            1            0.07	       0.07	      0.02%	      0.00	     0.00%                 LIST  /api/data/Package
           26            1.19	       0.00	      0.43%	      0.00	     0.00%                       Other     



Throughput
..........


A command is available to show the number of API calls
at particular intervals from a given start time and then to provide a
*throughput* value for the transaction, in other words number of requests per time
interval.

The command and parameters are:

* **voss report api throughput [OPTIONS] START_TIME INTERVALS DURATION**
* ``START_TIME`` - The date-time value from which to start the API call collection.
  Valid formats: `'%Y-%m-%d_%H:%M:%S', '%Y-%m-%d_%H:%M', '%Y-%m-%d'`
* ``INTERVALS`` - Number of report entries to list.
* ``DURATION`` - Number of seconds between each report entry.
* Options:
  
  * ``--path TEXT`` API log file path (default is ``nginx/access.log``)


The command output shows API request count data and throughput in columns.

Column headers:

* **Throughput**: ratio: (Count /  minutes (end_time - start_time))
* **SvcTime**, **RespTime**: time per request over timestamp period
* **Qtime**: defaults to 0 - not used


* Example **Throughput** of API requests:

  ``DURATION`` is 30 seconds (0.5 minutes)

  1 API request / 0.5 minutes = 2.00


::

   platform@VOSS:~$ voss report api throughput 2019-05-06_15:49 10 30
   Timestamp                Count       Qtime        SvcTime       RespTime     Throughput
   2019-05-06_15:49:00          1        0.00           1.47           1.47           2.00
   2019-05-06_15:49:30         27        0.00           0.56           0.56          54.00
   2019-05-06_15:50:00         28        0.00           0.49           0.49          56.00
   2019-05-06_15:50:30         32        0.00           0.42           0.42          64.00
   2019-05-06_15:51:00         25        0.00           0.49           0.49          50.00
   2019-05-06_15:51:30         21        0.00           0.59           0.59          42.00
   2019-05-06_15:52:00         20        0.00           0.59           0.59          40.00
   2019-05-06_15:52:30         28        0.00           0.51           0.51          56.00
   2019-05-06_15:53:00         29        0.00           0.44           0.44          58.00
   2019-05-06_15:53:30         21        0.00           0.63           0.63          42.00
   
