Add long-running logs
This commit is contained in:
parent
c193962c92
commit
f3e16dcd10
2 changed files with 17 additions and 0 deletions
|
@ -288,6 +288,7 @@ handle_call({put, Bucket, Key, Object, IndexSpecs, Tag, TTL}, From, State) ->
|
||||||
false ->
|
false ->
|
||||||
gen_server:reply(From, ok)
|
gen_server:reply(From, ok)
|
||||||
end,
|
end,
|
||||||
|
maybe_longrunning(SW, overall_put),
|
||||||
case maybepush_ledgercache(State#state.cache_size,
|
case maybepush_ledgercache(State#state.cache_size,
|
||||||
Cache0,
|
Cache0,
|
||||||
State#state.penciller) of
|
State#state.penciller) of
|
||||||
|
@ -472,6 +473,14 @@ update_put_timings({?PUT_TIMING_LOGPOINT, {Total0, Total1}, {Max0, Max1}},
|
||||||
update_put_timings({N, {Total0, Total1}, {Max0, Max1}}, T0, T1) ->
|
update_put_timings({N, {Total0, Total1}, {Max0, Max1}}, T0, T1) ->
|
||||||
{N + 1, {Total0 + T0, Total1 + T1}, {max(Max0, T0), max(Max1, T1)}}.
|
{N + 1, {Total0 + T0, Total1 + T1}, {max(Max0, T0), max(Max1, T1)}}.
|
||||||
|
|
||||||
|
maybe_longrunning(SW, Aspect) ->
|
||||||
|
case timer:now_diff(os:timestamp(), SW) of
|
||||||
|
N when N > 80000 ->
|
||||||
|
leveled_log:log("B0013", [N, Aspect]);
|
||||||
|
_ ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
cache_size(LedgerCache) ->
|
cache_size(LedgerCache) ->
|
||||||
leveled_skiplist:size(LedgerCache#ledger_cache.skiplist).
|
leveled_skiplist:size(LedgerCache#ledger_cache.skiplist).
|
||||||
|
@ -747,6 +756,7 @@ startup(InkerOpts, PencillerOpts) ->
|
||||||
|
|
||||||
|
|
||||||
fetch_head(Key, Penciller, LedgerCache) ->
|
fetch_head(Key, Penciller, LedgerCache) ->
|
||||||
|
SW = os:timestamp(),
|
||||||
Hash = leveled_codec:magic_hash(Key),
|
Hash = leveled_codec:magic_hash(Key),
|
||||||
if
|
if
|
||||||
Hash /= no_lookup ->
|
Hash /= no_lookup ->
|
||||||
|
@ -755,20 +765,25 @@ fetch_head(Key, Penciller, LedgerCache) ->
|
||||||
LedgerCache#ledger_cache.skiplist),
|
LedgerCache#ledger_cache.skiplist),
|
||||||
case L0R of
|
case L0R of
|
||||||
{value, Head} ->
|
{value, Head} ->
|
||||||
|
maybe_longrunning(SW, local_head),
|
||||||
Head;
|
Head;
|
||||||
none ->
|
none ->
|
||||||
case leveled_penciller:pcl_fetch(Penciller, Key, Hash) of
|
case leveled_penciller:pcl_fetch(Penciller, Key, Hash) of
|
||||||
{Key, Head} ->
|
{Key, Head} ->
|
||||||
|
maybe_longrunning(SW, pcl_head),
|
||||||
Head;
|
Head;
|
||||||
not_present ->
|
not_present ->
|
||||||
|
maybe_longrunning(SW, pcl_head),
|
||||||
not_present
|
not_present
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fetch_value(Key, SQN, Inker) ->
|
fetch_value(Key, SQN, Inker) ->
|
||||||
|
SW = os:timestamp(),
|
||||||
case leveled_inker:ink_fetch(Inker, Key, SQN) of
|
case leveled_inker:ink_fetch(Inker, Key, SQN) of
|
||||||
{ok, Value} ->
|
{ok, Value} ->
|
||||||
|
maybe_longrunning(SW, inker_fetch),
|
||||||
Value;
|
Value;
|
||||||
not_present ->
|
not_present ->
|
||||||
not_present
|
not_present
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
{"B0012",
|
{"B0012",
|
||||||
{info, "After ~w PUTs total inker time is ~w total ledger time is ~w "
|
{info, "After ~w PUTs total inker time is ~w total ledger time is ~w "
|
||||||
++ "and max inker time is ~w and max ledger time is ~w"}},
|
++ "and max inker time is ~w and max ledger time is ~w"}},
|
||||||
|
{"B0013",
|
||||||
|
{warn, "Long running task took ~w microseconds with task of type ~w"}},
|
||||||
|
|
||||||
{"P0001",
|
{"P0001",
|
||||||
{info, "Ledger snapshot ~w registered"}},
|
{info, "Ledger snapshot ~w registered"}},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue