From a1dcc5a8cd083e8c3b0626db17205582ae767a71 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sun, 15 May 2022 17:16:18 +0200 Subject: [PATCH] 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 --- pkg/arvo/gen/hood/gall-sift.hoon | 8 +++ pkg/arvo/gen/hood/gall-verb.hoon | 11 ++++ pkg/arvo/lib/hood/helm.hoon | 10 +++ pkg/arvo/sys/lull.hoon | 5 ++ pkg/arvo/sys/vane/gall.hoon | 105 +++++++++++++++++++++++++------ 5 files changed, 120 insertions(+), 19 deletions(-) create mode 100644 pkg/arvo/gen/hood/gall-sift.hoon create mode 100644 pkg/arvo/gen/hood/gall-verb.hoon diff --git a/pkg/arvo/gen/hood/gall-sift.hoon b/pkg/arvo/gen/hood/gall-sift.hoon new file mode 100644 index 000000000..9f02165ee --- /dev/null +++ b/pkg/arvo/gen/hood/gall-sift.hoon @@ -0,0 +1,8 @@ +:: Helm: Set Gall Verbosity by Agent +:: +/? 310 +:: +:- %say +|= [^ dudes=(list dude:gall) ~] +:- %helm-gall-sift +dudes diff --git a/pkg/arvo/gen/hood/gall-verb.hoon b/pkg/arvo/gen/hood/gall-verb.hoon new file mode 100644 index 000000000..32b445701 --- /dev/null +++ b/pkg/arvo/gen/hood/gall-verb.hoon @@ -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 diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 055cec9f3..d2240f3ac 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -200,6 +200,14 @@ |= veb=(list verb:ames) =< abet (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 |= ~ =< abet (emit %pass /helm %arvo %a %stir '') @@ -237,6 +245,8 @@ %helm-code =;(f (f !<(_+<.f vase)) poke-code) %helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve) %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-knob =;(f (f !<(_+<.f vase)) poke-knob) %helm-mass =;(f (f !<(_+<.f vase)) poke-mass) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index fba3c4d69..f6aa94fd2 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -1653,6 +1653,8 @@ $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade $>(%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 +$ boat :: outgoing subs @@ -1693,6 +1695,9 @@ $% [%raw-fact =mark =noun] sign:agent == + :: TODO: add more flags? + :: + +$ verb ?(%odd) :: :: +agent: app core :: diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 793b7bd00..631662ed8 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -4,15 +4,45 @@ :: :::: |= our=ship +:: veb: verbosity flags +:: +=/ veb-all-off + :: TODO: add more flags? + :: + :* odd=`?`%.n :: unusual events + == =, 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 :: :: $move: Arvo-level move :: +$ 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: overall gall state @@ -22,6 +52,7 @@ :: contacts: other ships we're in communication with :: yokes: running agents :: blocked: moves to agents that haven't been started yet +:: bug: debug printing configuration :: +$ state $: system-duct=duct @@ -29,6 +60,7 @@ contacts=(set ship) yokes=(map term yoke) blocked=(map term (qeu blocked-move)) + =bug == :: $watches: subscribers and publications :: @@ -126,6 +158,7 @@ contacts=(set ship) eggs=(map term egg) blocked=(map term (qeu blocked-move)) + =bug == :: $egg: migratory agent state; $yoke with .old-state instead of .agent :: @@ -169,7 +202,7 @@ [^duct %pass /whiz/gall %$ %whiz ~]~ =/ adult adult-core =. 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 =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore) @@ -288,7 +321,7 @@ ++ spore-8-to-9 |= old=spore-8 ^- ^spore - =- old(- %9, eggs -) + =- old(- %9, eggs -, blocked [blocked.old *bug]) %- ~(run by eggs.old) |= =egg-8 ^- egg @@ -332,6 +365,12 @@ ++ mo ~% %gall-mo +> ~ |_ [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-abet: finalize, reversing 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) %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 :: :: An inner, agent-level core. The sample refers to the agent we're @@ -1038,6 +1099,12 @@ agent-config=(list (each suss tang)) =yoke == + :: + ++ trace + |= [verb=? print=tang] + ^+ same + (^trace verb agent-name print) + :: ++ ap-core . :: +ap-abed: initialise state for an agent, with the supplied routes. :: @@ -1528,29 +1595,28 @@ :: %watch-ack ?. (~(has by outbound.watches.yoke) sub-key) - %- %: slog - leaf+"{}: got ack for nonexistent subscription" - leaf+"{}: {}" - >wire=wire< - ~ - == - ap-core + %. ap-core + %+ trace odd.veb.bug.state :~ + leaf+"{}: got ack for nonexistent subscription" + leaf+"{}: {}" + >wire=wire< + == =. outbound.watches.yoke ?^ p.sign (~(del by outbound.watches.yoke) sub-key) :: %+ ~(jab by outbound.watches.yoke) sub-key |= val=[acked=? =path nonce=@] - =? . acked.val - %.(. (slog leaf+"{} 2nd watch-ack on {}" ~)) - val(acked &) + %. val(acked &) + %^ trace &(odd.veb.bug.state acked.val) + leaf/"{} 2nd watch-ack on {}" ~ :: ingest-and-check-error == :: ++ on-missing %. ap-core - %- slog :~ + %+ trace odd.veb.bug.state :~ leaf+"{}: got {<-.sign>} for nonexistent subscription" leaf+"{}: {<[nonce=nonce agent-wire]>}" >wire=wire< @@ -1558,7 +1624,7 @@ :: ++ on-weird-kick %. run-sign - %- slog :~ + %+ trace odd.veb.bug.state :~ leaf+"{}: got %kick for nonexistent subscription" leaf+"{}: {}" >wire=wire< @@ -1776,10 +1842,9 @@ =/ sub-wire=^wire (slag 6 `^wire`wire) :: ?. (~(has by outbound.watches.yoke) sub-wire dock) - =; =tang - %- (slog tang) - $(moves t.moves) - [leaf+"gall: {} missing subscription, got %leave"]~ + %. $(moves t.moves) + %^ trace odd.veb.bug.state + leaf/"gall: {} missing subscription, got %leave" ~ =/ have=[acked=? =path nonce=@] (~(got by outbound.watches.yoke) sub-wire dock) =. p.move.move @@ -1860,6 +1925,8 @@ %jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task) %idle mo-abet:(mo-idle: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] %vega [~ gall-payload] ==