4. Command line interface

The rated package comes with a program called ratectl that can be used to manage any aspect of the rated process. This section is a guide for that program.

Every command have a --help flag to display available options.

The ratectl program communicates with the rated processes over the control sockets. The raw JSON response data can be useful when using the CLI for scripting with tools like jq, and the request data can be useful when learning about the API. Therefore, the commands have a --json output flag making it return the raw response and a --json-request flag that prints the raw request (JSON encoded).

4.1. Configuration management

These sub-commands can reload the running configuration See the configuration section for more information.

4.1.1. Reloading configurations

You can also invoke the individual reload commands directly:

$ ratectl reload                           # /etc/halon/rated-app.yaml

4.2. Rate function

It’s possible to both list and clear rate. As per the example below.

$ ratectl list
┌───────────────────┬────────────┬───────┬─────────────┬────────┬────────┬────────────┐
│ Namespace         │ Entry      │ Count │ Local count │ Oldest │ Newest │ Rate (#/s) │
├───────────────────┼────────────┼───────┼─────────────┼────────┼────────┼────────────┤
│ delivery-failures │ customer0  │     1 │           1 │      8 │      8 │          0 │
│ delivery-failures │ customer1  │     5 │           5 │     12 │      4 │      0.625 │
│ delivery-failures │ customer10 │     1 │           1 │      8 │      8 │          0 │
...
$ ratectl clear --entry customer10
1 entries deleted