Accessing QPM Data by Cluster for Untethered Deployments

QPM, or Queries per Month, is the total count of all Traffic/API calls made in a month. It includes all requests regardless of response status.

QPM Implementation

  1. Every API request gets captured as an access log.
  2. Each access log is transferred to the log service.
  3. Every time the log service encounters an incoming access log, it increments the counter.
    Note: The counters are stored in the log pod/container at /mnt/data/trafficmanager.
  4. At the turn of every 1 hour, on the zeroth minute, the counter is written to a disk.
    Note: This is similar to cron setting of 0 * * * *.
  5. The counter is then reset to 0 for the counts of the next hour.

How to find the QPM

To find the total count of queries for a given month, a convenient script is available on the log pod/container at /opt/mashery/containeragent/bin/getCounts.sh.

You'll need to provide the -t| -time mm-yyyy parameter to execute the script successfully.

Usage:
getCounts.sh -t|--time mm-yyyy
Examples:
getCounts.sh -t 04-2019
or
getCounts.sh --time 04-2019
Example execution of getCounts.shgetCounts.sh
/opt/mashery/containeragent/bin/getCounts.sh -t 04-2019
Output:
Counting total number of access logs
234
Finished counting of access logs

How to Check Compliance using QPM Implementation

  1. Run the following command (for Docker Swarm) on each Log Pod/Container:
    docker exec -it <containerid> /opt/mashery/containeragent/bin/getCounts.sh <mm-yyyy>
    
    Example:
    docker exec -it <containerid> /opt/mashery/containeragent/bin/getCounts.sh 04-2019
  2. Add up the output for each of the pods.

    QPM = LogService1_Total+LogService2_total....+LogService*n*_total