feat(ds): Implement format_status callback
Reduce volume of logs and crash reports from DS
This commit is contained in:
parent
1526c527d0
commit
e4a73f003a
|
@ -33,7 +33,7 @@
|
|||
-export([start_link/2, store_batch/3]).
|
||||
|
||||
%% behavior callbacks:
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
|
||||
-export([init/1, format_status/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
|
||||
|
||||
%% internal exports:
|
||||
-export([]).
|
||||
|
@ -129,6 +129,13 @@ init([DB, Shard]) ->
|
|||
},
|
||||
{ok, S}.
|
||||
|
||||
format_status(#s{db = DB, shard = Shard, queue = Q}) ->
|
||||
#{
|
||||
db => DB,
|
||||
shard => Shard,
|
||||
queue => queue:len(Q)
|
||||
}.
|
||||
|
||||
handle_call(
|
||||
#enqueue_req{
|
||||
messages = Msgs,
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
]).
|
||||
|
||||
%% gen_server
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
|
||||
-export([init/1, format_status/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
|
||||
|
||||
%% internal exports:
|
||||
-export([db_dir/1]).
|
||||
|
@ -586,6 +586,24 @@ init({ShardId, Options}) ->
|
|||
commit_metadata(S),
|
||||
{ok, S}.
|
||||
|
||||
format_status(#s{shard_id = ShardId, db = DB, cf_refs = CFRefs, schema = Schema, shard = Shard}) ->
|
||||
#{
|
||||
id => ShardId,
|
||||
db => DB,
|
||||
cf_refs => CFRefs,
|
||||
schema => Schema,
|
||||
shard =>
|
||||
maps:map(
|
||||
fun
|
||||
(?GEN_KEY(_), _Schema) ->
|
||||
'...';
|
||||
(_K, Val) ->
|
||||
Val
|
||||
end,
|
||||
Shard
|
||||
)
|
||||
}.
|
||||
|
||||
handle_call(#call_update_config{since = Since, options = Options}, _From, S0) ->
|
||||
case handle_update_config(S0, Since, Options) of
|
||||
S = #s{} ->
|
||||
|
|
Loading…
Reference in New Issue