canonical / operator

Pure Python framework for writing Juju charms
Apache License 2.0
246 stars 119 forks source link

log event deferral and re-emission #404

Closed chipaca closed 3 years ago

chipaca commented 4 years ago

Currently there is very little logging around events that are defered and subsequently re-emitted, making debugging of spurious or erroneous defers harder than it should be.

We should log (in DEBUG) both the deferal and the subsequent re-emission.

jnsgruk commented 3 years ago

I think this is solved, so will close this for now, but can re-open if needed. See below:

unit-jnsgruk-kubernetes-dashboard-0: 11:26:38 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Emitting Juju event install.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:38 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Deferring <InstallEvent via KubernetesDashboardCharm/on/install[1]>.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 INFO juju.worker.uniter.operation ran "install" hook (via hook dispatching script: dispatch)
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 INFO juju.worker.uniter found queued "leader-elected" hook
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Operator Framework 1.2.0 up and running.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Legacy hooks/leader-elected does not exist.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Re-emitting <InstallEvent via KubernetesDashboardCharm/on/install[1]>.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Deferring <InstallEvent via KubernetesDashboardCharm/on/install[1]>.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:39 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Emitting Juju event leader_elected.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:40 INFO juju.worker.uniter.operation ran "leader-elected" hook (via hook dispatching script: dispatch)
unit-jnsgruk-kubernetes-dashboard-0: 11:26:40 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Operator Framework 1.2.0 up and running.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:40 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Legacy hooks/dashboard-pebble-ready does not exist.
unit-jnsgruk-kubernetes-dashboard-0: 11:26:40 DEBUG unit.jnsgruk-kubernetes-dashboard/0.juju-log Re-emitting <InstallEvent via KubernetesDashboardCharm/on/install[1]>.