basho / riak_repl

Riak DC Replication
Apache License 2.0
56 stars 32 forks source link

Make riak-repl status parsable using Unix CLI tools [JIRA: RIAK-1865] #698

Open binarytemple opened 9 years ago

binarytemple commented 9 years ago

It's horrrrrrrible. I mean this ugly.

sam_dog

A mix of Erlang syntax, and regular lines.

If it were just Erlang terms it could be copied into an Erlang console and operated on.

If it were text, like the riak.conf it could be parsed with sed, awk, etc.

But nothing can parse it, well not without writing a Lexer/Parser, gaaah!

fullsync_coordinator: []
fullsync_coordinator_srv: []
cluster_name: <<"riak1">>
cluster_leader: 'dev1@127.0.0.1'
connected_clusters: [<<"riak2">>]
realtime_queue_stats: [{bytes,768},
                       {max_bytes,104857600},
                       {consumers,[{"riak2",
                                    [{pending,0},
                                     {unacked,0},
                                     {drops,0},
                                     {errs,0}]}]},
                       {overload_drops,0}]
proxy_get: [{requester,[]},{provider,[]}]
realtime_send_kbps: 0
realtime_recv_kgbps: 0
fullsync_send_kbps: 0
fullsync_recv_kbps: 0

Wouldn't it look nicer like this? :

fullsync_coordinator=
fullsync_coordinator_srv=
cluster_name=riak1
cluster_leader=dev1@127.0.0.1
connected_clusters=riak2
realtime_queue_stats.bytes=768
realtime_queue_stats.max_bytes=104857600
realtime_queue_stats.consumers.riak2.pending=0
realtime_queue_stats.consumers.riak2.pending=0
realtime_queue_stats.consumers.riak2.unacked=0
realtime_queue_stats.consumers.riak2.drops=0
realtime_queue_stats.consumers.riak2.errs=0
realtime_queue_stats.overload_drops=0
realtime_queue_stats.proxy_get.requester=
realtime_queue_stats.proxy_get.provider=
realtime_send_kbps=0
realtime_recv_kgbps=0
fullsync_send_kbps=0
fullsync_recv_kbps=0
binarytemple commented 9 years ago

Been messing around this weekend poc_erlang_flattener. Early stages (and my Erlang is super lame), but couldn't we implement something like this that we could just fire the nested proplists into and they come out the other side all pretty?

angrycub commented 9 years ago

Just emitting the json blob that we send to the /stats endpoint would allow for python/ruby/jq to parse the data and extract useful information

bsparrow435 commented 9 years ago

Customer just +1'd using a json format from the /stats endpoint here would be very useful