gall: print trace logs by agent

This uses the same patterns found in %ames. We add an %odd flag
for logs related to the gall-rq PR, and leave it open for other flags
This commit is contained in:
yosoyubik 2022-05-15 17:16:18 +02:00
parent 350636fe2a
commit a1dcc5a8cd
5 changed files with 120 additions and 19 deletions

View File

@ -0,0 +1,8 @@
:: Helm: Set Gall Verbosity by Agent
::
/? 310
::
:- %say
|= [^ dudes=(list dude:gall) ~]
:- %helm-gall-sift
dudes

View File

@ -0,0 +1,11 @@
:: Helm: Adjust Gall verbosity
::
:: List of diagnostic flags is in verb:gall in zuse.hoon, documented in
:: gall.hoon
::
/? 310
::
:- %say
|= [^ veb=(list verb:gall) ~]
:- %helm-gall-verb
veb

View File

@ -200,6 +200,14 @@
|= veb=(list verb:ames) =< abet |= veb=(list verb:ames) =< abet
(emit %pass /helm %arvo %a %spew veb) (emit %pass /helm %arvo %a %spew veb)
:: ::
++ poke-gall-sift
|= dudes=(list dude:gall) =< abet
(emit %pass /helm %arvo %g %sift dudes)
::
++ poke-gall-verb
|= veb=(list verb:gall) =< abet
(emit %pass /helm %arvo %g %spew veb)
::
++ poke-ames-wake ++ poke-ames-wake
|= ~ =< abet |= ~ =< abet
(emit %pass /helm %arvo %a %stir '') (emit %pass /helm %arvo %a %stir '')
@ -237,6 +245,8 @@
%helm-code =;(f (f !<(_+<.f vase)) poke-code) %helm-code =;(f (f !<(_+<.f vase)) poke-code)
%helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve) %helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve)
%helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject) %helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject)
%helm-gall-sift =;(f (f !<(_+<.f vase)) poke-gall-sift)
%helm-gall-verb =;(f (f !<(_+<.f vase)) poke-gall-verb)
%helm-hi =;(f (f !<(_+<.f vase)) poke-hi) %helm-hi =;(f (f !<(_+<.f vase)) poke-hi)
%helm-knob =;(f (f !<(_+<.f vase)) poke-knob) %helm-knob =;(f (f !<(_+<.f vase)) poke-knob)
%helm-mass =;(f (f !<(_+<.f vase)) poke-mass) %helm-mass =;(f (f !<(_+<.f vase)) poke-mass)

View File

@ -1653,6 +1653,8 @@
$>(%trim vane-task) :: trim state $>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
$>(%plea vane-task) :: network request $>(%plea vane-task) :: network request
[%spew veb=(list verb)] :: set verbosity
[%sift dudes=(list dude)] :: per agent
== :: == ::
+$ bitt (map duct (pair ship path)) :: incoming subs +$ bitt (map duct (pair ship path)) :: incoming subs
+$ boat :: outgoing subs +$ boat :: outgoing subs
@ -1693,6 +1695,9 @@
$% [%raw-fact =mark =noun] $% [%raw-fact =mark =noun]
sign:agent sign:agent
== ==
:: TODO: add more flags?
::
+$ verb ?(%odd)
:: ::
:: +agent: app core :: +agent: app core
:: ::

View File

@ -4,15 +4,45 @@
:: ::
:::: ::::
|= our=ship |= our=ship
:: veb: verbosity flags
::
=/ veb-all-off
:: TODO: add more flags?
::
:* odd=`?`%.n :: unusual events
==
=, gall =, gall
=> =>
|% |%
+| %helpers
:: +trace: print if .verb is set and we're tracking .dude
::
++ trace
|= [verb=? =dude dudes=(set dude) print=tang]
^+ same
?. verb
same
?. => [dude=dude dudes=dudes in=in]
~+ |(=(~ dudes) (~(has in dudes) dude))
same
(slog print)
::
:: $bug: debug printing configuration
::
:: veb: verbosity toggles
:: dudes: app filter; if ~, print for all
::
+$ bug
$: veb=_veb-all-off
dudes=(set dude)
==
::
+| %main +| %main
:: ::
:: $move: Arvo-level move :: $move: Arvo-level move
:: ::
+$ move [=duct move=(wind note-arvo gift-arvo)] +$ move [=duct move=(wind note-arvo gift-arvo)]
:: $state-8: overall gall state, versioned :: $state-9: overall gall state, versioned
:: ::
+$ state-9 [%9 state] +$ state-9 [%9 state]
:: $state: overall gall state :: $state: overall gall state
@ -22,6 +52,7 @@
:: contacts: other ships we're in communication with :: contacts: other ships we're in communication with
:: yokes: running agents :: yokes: running agents
:: blocked: moves to agents that haven't been started yet :: blocked: moves to agents that haven't been started yet
:: bug: debug printing configuration
:: ::
+$ state +$ state
$: system-duct=duct $: system-duct=duct
@ -29,6 +60,7 @@
contacts=(set ship) contacts=(set ship)
yokes=(map term yoke) yokes=(map term yoke)
blocked=(map term (qeu blocked-move)) blocked=(map term (qeu blocked-move))
=bug
== ==
:: $watches: subscribers and publications :: $watches: subscribers and publications
:: ::
@ -126,6 +158,7 @@
contacts=(set ship) contacts=(set ship)
eggs=(map term egg) eggs=(map term egg)
blocked=(map term (qeu blocked-move)) blocked=(map term (qeu blocked-move))
=bug
== ==
:: $egg: migratory agent state; $yoke with .old-state instead of .agent :: $egg: migratory agent state; $yoke with .old-state instead of .agent
:: ::
@ -169,7 +202,7 @@
[^duct %pass /whiz/gall %$ %whiz ~]~ [^duct %pass /whiz/gall %$ %whiz ~]~
=/ adult adult-core =/ adult adult-core
=. state.adult =. state.adult
[%9 system-duct outstanding contacts yokes=~ blocked]:spore [%9 system-duct outstanding contacts yokes=~ blocked bug]:spore
=/ mo-core (mo-abed:mo:adult duct) =/ mo-core (mo-abed:mo:adult duct)
=. mo-core =. mo-core
=/ apps=(list [dap=term =egg]) ~(tap by eggs.spore) =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore)
@ -288,7 +321,7 @@
++ spore-8-to-9 ++ spore-8-to-9
|= old=spore-8 |= old=spore-8
^- ^spore ^- ^spore
=- old(- %9, eggs -) =- old(- %9, eggs -, blocked [blocked.old *bug])
%- ~(run by eggs.old) %- ~(run by eggs.old)
|= =egg-8 |= =egg-8
^- egg ^- egg
@ -332,6 +365,12 @@
++ mo ++ mo
~% %gall-mo +> ~ ~% %gall-mo +> ~
|_ [hen=duct moves=(list move)] |_ [hen=duct moves=(list move)]
::
++ trace
|= [verb=? =dude print=tang]
^+ same
(^trace verb dude dudes.bug.state print)
::
:: +mo-abed: initialise state with the provided duct :: +mo-abed: initialise state with the provided duct
:: +mo-abet: finalize, reversing moves :: +mo-abet: finalize, reversing moves
:: +mo-pass: prepend a standard %pass to the current list of moves :: +mo-pass: prepend a standard %pass to the current list of moves
@ -1024,6 +1063,28 @@
%d (mo-give %unto %raw-fact mark.ames-response noun.ames-response) %d (mo-give %unto %raw-fact mark.ames-response noun.ames-response)
%x (mo-give %unto %kick ~) %x (mo-give %unto %kick ~)
== ==
:: +mo-spew: handle request to set verbosity toggles on debug output
::
++ mo-spew
|= verbs=(list verb)
^+ mo-core
:: start from all %.n's, then flip requested toggles
::
=. veb.bug.state
%+ roll verbs
|= [=verb acc=_veb-all-off]
^+ veb.bug.state
?- verb
%odd acc(odd %.y)
==
mo-core
:: +mo-sift: handle request to filter debug output by agent
::
++ mo-sift
|= dudes=(list dude)
^+ mo-core
=. dudes.bug.state (sy dudes)
mo-core
:: +ap: agent engine :: +ap: agent engine
:: ::
:: An inner, agent-level core. The sample refers to the agent we're :: An inner, agent-level core. The sample refers to the agent we're
@ -1038,6 +1099,12 @@
agent-config=(list (each suss tang)) agent-config=(list (each suss tang))
=yoke =yoke
== ==
::
++ trace
|= [verb=? print=tang]
^+ same
(^trace verb agent-name print)
::
++ ap-core . ++ ap-core .
:: +ap-abed: initialise state for an agent, with the supplied routes. :: +ap-abed: initialise state for an agent, with the supplied routes.
:: ::
@ -1528,29 +1595,28 @@
:: ::
%watch-ack %watch-ack
?. (~(has by outbound.watches.yoke) sub-key) ?. (~(has by outbound.watches.yoke) sub-key)
%- %: slog %. ap-core
%+ trace odd.veb.bug.state :~
leaf+"{<agent-name>}: got ack for nonexistent subscription" leaf+"{<agent-name>}: got ack for nonexistent subscription"
leaf+"{<dock>}: {<agent-wire>}" leaf+"{<dock>}: {<agent-wire>}"
>wire=wire< >wire=wire<
~
== ==
ap-core
=. outbound.watches.yoke =. outbound.watches.yoke
?^ p.sign ?^ p.sign
(~(del by outbound.watches.yoke) sub-key) (~(del by outbound.watches.yoke) sub-key)
:: ::
%+ ~(jab by outbound.watches.yoke) sub-key %+ ~(jab by outbound.watches.yoke) sub-key
|= val=[acked=? =path nonce=@] |= val=[acked=? =path nonce=@]
=? . acked.val %. val(acked &)
%.(. (slog leaf+"{<agent-name>} 2nd watch-ack on {<val>}" ~)) %^ trace &(odd.veb.bug.state acked.val)
val(acked &) leaf/"{<agent-name>} 2nd watch-ack on {<val>}" ~
:: ::
ingest-and-check-error ingest-and-check-error
== ==
:: ::
++ on-missing ++ on-missing
%. ap-core %. ap-core
%- slog :~ %+ trace odd.veb.bug.state :~
leaf+"{<agent-name>}: got {<-.sign>} for nonexistent subscription" leaf+"{<agent-name>}: got {<-.sign>} for nonexistent subscription"
leaf+"{<dock>}: {<[nonce=nonce agent-wire]>}" leaf+"{<dock>}: {<[nonce=nonce agent-wire]>}"
>wire=wire< >wire=wire<
@ -1558,7 +1624,7 @@
:: ::
++ on-weird-kick ++ on-weird-kick
%. run-sign %. run-sign
%- slog :~ %+ trace odd.veb.bug.state :~
leaf+"{<agent-name>}: got %kick for nonexistent subscription" leaf+"{<agent-name>}: got %kick for nonexistent subscription"
leaf+"{<dock>}: {<agent-wire>}" leaf+"{<dock>}: {<agent-wire>}"
>wire=wire< >wire=wire<
@ -1776,10 +1842,9 @@
=/ sub-wire=^wire (slag 6 `^wire`wire) =/ sub-wire=^wire (slag 6 `^wire`wire)
:: ::
?. (~(has by outbound.watches.yoke) sub-wire dock) ?. (~(has by outbound.watches.yoke) sub-wire dock)
=; =tang %. $(moves t.moves)
%- (slog tang) %^ trace odd.veb.bug.state
$(moves t.moves) leaf/"gall: {<agent-name>} missing subscription, got %leave" ~
[leaf+"gall: {<agent-name>} missing subscription, got %leave"]~
=/ have=[acked=? =path nonce=@] =/ have=[acked=? =path nonce=@]
(~(got by outbound.watches.yoke) sub-wire dock) (~(got by outbound.watches.yoke) sub-wire dock)
=. p.move.move =. p.move.move
@ -1860,6 +1925,8 @@
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task) %jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
%idle mo-abet:(mo-idle:mo-core dude.task) %idle mo-abet:(mo-idle:mo-core dude.task)
%nuke mo-abet:(mo-nuke:mo-core dude.task) %nuke mo-abet:(mo-nuke:mo-core dude.task)
%spew mo-abet:(mo-spew:mo-core veb.task)
%sift mo-abet:(mo-sift:mo-core dudes.task)
%trim [~ gall-payload] %trim [~ gall-payload]
%vega [~ gall-payload] %vega [~ gall-payload]
== ==