/json_table

a rust tool to display array of json objects as an ascii table

Primary LanguageRust

json_table

a small to that can read json object arrays from file or stdin and display an ascii table

$ json_table -h

json_table 0.1.0
Display array of json objects as an ascii table

USAGE:
    json_table [OPTIONS] [source]

ARGS:
    <source>    optional source to operate on. if none provided, will read from stdin

OPTIONS:
    -c, --columns <VALUE>     the columns to display separated by a colon. if none provided, all
                              columns will be displayed
    -h, --help                Print help information
        --order <VALUE>       the sorting order. Default is asc
        --page <VALUE>        the page to display
        --pagesize <VALUE>    the page size to display
    -s, --skip <VALUE>        the number of lines to skip. if none provided, all lines will be
                              displayed
        --sort <VALUE>        the column name to sort
    -t, --take <VALUE>        the number of lines to display. if none provided, all lines will be
                              displayed
    -V, --version             Print version information

install

cargo install --git https://github.com/mathieuancelin/json_table

usage example

$ curl -s 'http://otoroshi-api.oto.tools:9999/metrics?filter=ng-report-*' | json_table -c name,mean,min,max,count --sort mean --order desc

+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| index | name                                                                                                    | mean                 | min                   | max                  | count |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 1     | ng-report-request-duration                                                                              | 165.12603199999998   | 12.115439             | 460.014802           | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 2     | ng-report-request-step-call-backend                                                                     | 118.235168           | 0.942967              | 273.538212           | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 3     | ng-report-request-overhead                                                                              | 47.75387             | 5.04931               | 180.96672            | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 4     | ng-report-request-overhead-in                                                                           | 43.918779            | 4.732781              | 186.431854           | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 5     | ng-report-request-step-call-access-validator-plugins                                                    | 30.127858999999997   | 2.436566              | 197.399682           | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 6     | ng-report-call-access-validator-plugins-plugin-cp:otoroshi.next.plugins.JwtVerification                 | 12.492072            | 0.998149              | 260.653227           | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 7     | ng-report-call-access-validator-plugins-plugin-cp:otoroshi.next.plugins.ApikeyCalls                     | 10.712524            | 0.049188              | 63.678532999999995   | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 8     | ng-report-call-access-validator-plugins-plugin-cp:otoroshi.next.plugins.JwtVerification-single          | 6.61679097201295     | 0.056068              | 28.732246999999997   | 78944 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 9     | ng-report-request-step-transform-request                                                                | 6.611635             | 1.115306              | 123.350454           | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 10    | ng-report-call-access-validator-plugins-plugin-cp:otoroshi.next.plugins.JwtVerification-internal        | 4.669449185755201    | 0.052617              | 36.072743            | 78944 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 11    | ng-report-request-overhead-out                                                                          | 3.835091             | 0.554808              | 87.824164            | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 12    | ng-report-request-step-find-route                                                                       | 3.4696059999999997   | 0.059424              | 3.4696059999999997   | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 13    | ng-report-request-step-trigger-analytics                                                                | 1.97338              | 0.036871              | 37.051496            | 39451 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 14    | ng-report-request-step-check-concurrent-requests                                                        | 1.884284             | 0.052281999999999995  | 4.900872             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 15    | ng-report-request-step-transform-response                                                               | 1.824724             | 0.489488              | 81.923721            | 39451 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 16    | ng-report-call-access-validator-plugins-plugin-cp:otoroshi.next.plugins.wrappers.AccessValidatorWrapper | 0.785327             | 0.020708              | 34.553377999999995   | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 17    | ng-report-transform-request-plugin-cp:otoroshi.next.plugins.MissingHeadersIn                            | 0.7741589999999999   | 0.046968              | 26.870775            | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 18    | ng-report-transform-request-plugin-cp:otoroshi.next.plugins.JwtVerification                             | 0.663763             | 0.002949              | 0.663763             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 19    | ng-report-request-step-start-handling                                                                   | 0.659095             | 0.01274               | 14.214104            | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 20    | ng-report-request-step-enforce-global-limits                                                            | 0.185031             | 0.027875              | 21.245679            | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 21    | ng-report-request-step-compute-plugins                                                                  | 0.049412             | 0.015989              | 5.365940999999999    | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 22    | ng-report-request-step-choose-backend                                                                   | 0.047708999999999994 | 0.018525              | 35.643927            | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 23    | ng-report-request-step-stream-response                                                                  | 0.029255999999999997 | 0.01353               | 26.697339            | 39451 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 24    | ng-report-transform-response-plugin-cp:otoroshi.next.plugins.SendOtoroshiHeadersBack                    | 0.028729             | 0.014212              | 1.594099             | 39451 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 25    | ng-report-request-step-call-before-request-callbacks                                                    | 0.015792             | 0.004939              | 0.426241             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 26    | ng-report-request-step-rendering-intermediate-result                                                    | 0.006803999999999999 | 0.006803999999999999  | 0.006803999999999999 | 1     |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 27    | ng-report-request-step-call-pre-route-plugins                                                           | 0.006676             | 0.0033959999999999997 | 0.381657             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 28    | ng-report-transform-request-plugin-cp:otoroshi.next.plugins.ApikeyCalls                                 | 0.00378              | 0.001735              | 0.546391             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 29    | ng-report-request-step-tenant-check                                                                     | 0.003374             | 0.000824              | 0.142644             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 30    | ng-report-request-step-check-global-maintenance                                                         | 0.002202             | 0.000785              | 0.085701             | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 31    | ng-report-request-step-extract-tracking-id                                                              | 0.000543             | 0.000472              | 0.03998              | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+
| 32    | ng-report-request-step-request-success                                                                  | 0                    | 0                     | 0                    | 39452 |
+-------+---------------------------------------------------------------------------------------------------------+----------------------+-----------------------+----------------------+-------+