Remedy Statistics Report
After one or more remedy plugins were configured and enabled, their effect can be inspected by using the
Lunar's Remedy Statistics Report records accumulative statistics that reveal how configured remedies acted and affected the traffic they encountered. This tool is meant to serve as a quick way to inspect that
policies.yaml is properly configured.
The output of this command is printed out in JSON format, the schema of which is described below.
How To Run
docker exec lunar-proxy remedy_stats
kubectl exec <lunar-proxy-pod-name> -- remedy_stats
// further per-plugin statistics (e.g. `account_orchestration`)...
// further per-action statistics (e.g. `modified`)...
While this utility is called Remedy Statistics Report, it takes into account all the HTTP calls (aka transactions) that reached Lunar Proxy, whether they were remediated, diagnosed, or were merely forwarded to the API provider by Lunar Proxy. This is done in order to calculate ratio fields, which we will describe in the below section. In any ratio field exposed by this utility, the denominator is always the total amount of transactions that reached Lunar Proxy.
In the example above, the total amount of transactions that reached Lunar Proxy is 21.
Remedy Action Type
As remedy plugins are meant to solve API consumption problems, they can either modify the request or the response of a transaction, or generate a response on their own and prevent the API call to the original provider. They can also do nothing, of course. Read more about remedy plugins here.
Data is aggregated on both the remedy plugin level and on the action-type level.
Remedy Plugin Level Statistics
The output's top-level field
remedy_stats holds an array in which each item describes the works of a specific remedy plugin. Data is aggregated on the plugin level, so if, for example, several Strategy Based Throttling policies are defined in
policies.yaml, the statistics regarding their effect will be aggregated into a single item in this array, each distinct by the
actionfield explains the effect of each plugin. This value can be either
generated, as explained above.
affected_countfield counts the total amount of transactions upon which this plugin had an effect.
affected_countby the total amount of transactions that reached Lunar Proxy.
affected_stats_by_endpointfield is an array which helps in understanding where were the affected transactions originally directed at and how their effective response status codes are distributed.
Action Type Level Statistics
The output's top-level field
remedy_action_stats holds an object which may contain two fields:
generated, each describing the aggregated works of one or more remedy plugins, grouped by their action type.
Each such field holds an object which contains the following fields:
countfield counts the total amount of transactions for which this action type was applied by remedy plugins.
ratiofield divides the
countfield by the total amount of transactions that reached Lunar Proxy.
ratio_by_status_codefield sheds light regarding the distribution of effective response status codes of the transactions in which this remedy action type was applied by remedy plugins. The ratio is calculated per status code from the total amount of transactions that reached Lunar Proxy.
Lunar Proxy will clear its Remedy Statistics Report state upon restart.