@eiri: Here is an extract from [`gen_server` documentation]
(http://erlang.org/doc/man/gen_server.html#Module:format_status-2)
> the recommended form for the Status value is [{data, [{"State", Term}]}],
> where Term provides relevant details of the gen_server state. Following this
> recommendation is not required, but it makes the callback module status
> consistent with the rest of the sys:get_status/1,2 return value.
I remember being inspired by the [following example from
OTP](https://github.com/erlang/otp/blob/d6285b0a347b9489ce939511ee9a979acd868f71/lib/os_mon/src/disksup.erl#L201)
```
format_status(_Opt, [_PDict, #state{os = OS, threshold = Threshold,
timeout = Timeout,
diskdata = DiskData}]) ->
[{data, [{"OS", OS},
{"Timeout", Timeout},
{"Threshold", Threshold},
{"DiskData", DiskData}]}].
```
The use of the function in otp is inconsistent:
-
[wx_object.erl](https://github.com/erlang/otp/blob/d6285b0a347b9489ce939511ee9a979acd868f71/lib/wx/src/wx_object.erl#L693)
```
Specific = [{data, [{"State", State}]}],
[{header, Header},
{data, [{"Status", SysState},
{"Parent", Parent},
{"Logged events", Log}]} |
Specfic].
```
-
[httpd_request_handler.erl](https://github.com/erlang/otp/blob/d6285b0a347b9489ce939511ee9a979acd868f71/lib/inets/src/http_server/httpd_request_handler.erl#L331)
```
[{data, [{"StateData", State}]}];
```
-
[supervisor.erl](https://github.com/erlang/otp/blob/d6285b0a347b9489ce939511ee9a979acd868f71/lib/stdlib/src/supervisor.erl#L1429)
```
[{data, [{"State", State}]},
{supervisor, [{"Callback", State#state.module}]}]
```
-
[memsup](https://github.com/erlang/otp/blob/1d5d8a8c5c7cc8f0e011bb121ef21787ece2be58/lib/os_mon/src/memsup.erl#L672:L675)
```
[{data, [{"Timeout", Timeout}]},
{items, {"Memory Usage", [
{"Allocated", Allocated},
{"Total", Total}]}},
{items, {"Worst Memory User", WorstMemFormat}}].
```
-
[ssh_connection_handler.erl](https://github.com/erlang/otp/blob/c1def1f61f74ac6e8e0703d01d0819d142c11de5/lib/ssh/src/ssh_connection_handler.erl#L1589)
```
[{data, [{"State", [{foo, 1}, {bar, 2}]}]}].
```
My guess is it might have to do with the way how observer or SASL uses this
data. Since we are not using either we should be able to use any format we want.
[ Full content available at: https://github.com/apache/couchdb/pull/1601 ]
This message was relayed via gitbox.apache.org for [email protected]