Telemetry and log reference
v0.1.14
Reference for what Mishka Installer reports while it runs: the :telemetry events of the event layer, the install layer and the Mnesia store, and the log messages that tell you a plugin or an install needs attention. Attach to the events to react to a rebuild or a boot. Read the logs to find a plugin that failed.
Attach a handler
Attach with :telemetry.attach/4 and detach first so a second attach is harmless. This is how Mishka CMS reacts when the library has finished starting its plugins:
@handler_id "mishka-cms-core-plugin-registrations"
@event [:mishka_installer, :event, :synchronized]
def attach do
:telemetry.detach(@handler_id)
:ok = :telemetry.attach(@handler_id, @event, &__MODULE__.handle_telemetry/4, nil)
endEvent layer
| Event | When | Metadata |
|---|---|---|
[:mishka_installer, :event, :compile] | After the handler compiles an event, whether or not the module changed. | :event, :result (:ok or :error) |
[:mishka_installer, :event, :synchronized] | Each time the event handler has started all events: on boot, and again whenever the store announces that it is ready. | :node |
[:mishka_installer, :event, :unregistered_gone] | For each plugin unregistered just before the events start, on boot and on each later start, because its application no longer has its module. | :plugin, :event, :extension |
The measurement of each is %{system_time: integer}.
:synchronized can fire more than once, so a handler must be safe to run again. The PubSub messages and readiness documentation lists when it repeats, and shows how to tell that the library is ready when your handler was attached too late to hear it.
Install layer
| Event | When | Metadata |
|---|---|---|
[:mishka_installer, :installer, :install] | After a queued install, made with async_install/1, ends. | :app (nil on an error), :result |
[:mishka_installer, :installer, :replay] | For each stored library loaded again when the store is ready. On boot it loads the library. On a later announcement the library is already running, and :result is :error. | :app, :result |
[:mishka_installer, :installer, :blocked] | When the allow policy refuses an install or an uninstall. | :kind (:url_hosts, :github_repos or :protected_apps), :value |
A call to install/1 emits no :install event. The measurement of each is %{system_time: integer}.
Mnesia store
| Event | When | Metadata |
|---|---|---|
[:mishka_installer, :mnesia, :init, :start], :stop, :exception | Around the boot of the store, as a :telemetry.span/3. :stop carries :duration. | :node, and on :stop also :result and :tables |
[:mishka_installer, :mnesia, :table] | For each essential table on boot. | :table, :status (:created, :already_exists, :already_loaded, :copied or :error) |
[:mishka_installer, :mnesia, :synchronized] | When the tables are ready, on boot and again each time the store announces itself. | :node, :tables |
[:mishka_installer, :mnesia, :health_check] | Every 10 seconds, outside the test environment. Measurements :table_count, :schema_count. | :node, :healthy?, :missing |
[:mishka_installer, :mnesia, :inconsistent_database] | When Mnesia reports a split brain. | :node, :context |
[:mishka_installer, :mnesia, :cluster, :nodeup] | When a node connects. | :node, :peer, :action (:joined, :connected, :already_member, :ignored, :pending, :unreachable or {:error, reason}) |
[:mishka_installer, :mnesia, :cluster, :nodedown] | When a node disconnects. The library only logs and reports it and never removes the node. | :node, :peer, :db_member? |
Log messages
The library logs with one prefix per layer and sets the Logger :domain metadata of its processes to [:mishka_installer, :event], [:mishka_installer, :installer] or [:mishka_installer, :mnesia]. The table lists the lines at info level and above. The library also writes debug lines, which are not listed.
| Level | Message | Meaning |
|---|---|---|
| error | [mishka_installer.event] plugin pipeline raised in event ... | A plugin raised or broke the reply contract. The call answered its input. |
| error | [mishka_installer.event] ... cannot run: [...] not loaded | A plugin is started but its module is not loaded. Every call answers cannot_run or its input. |
| error | [mishka_installer.event] ... failed to register on ... | A plugin's registration at boot returned an error, such as a cycle or a priority out of range. |
| error | [mishka_installer.event] compile failed for event ... | The module of an event could not be built. |
| error | [mishka_installer.event] compile error for event ... | A queued rebuild of an event failed. The compile failed for event line just before it gives the reason. |
| warning | [mishka_installer.event] unregistered ... from ... | The event handler removed a plugin whose application no longer has the module. |
| info | [mishka_installer.event] plugins synchronized | All events have started. It is logged again each time the store announces that it is ready. |
| info | [mishka_installer.installer] ... installed and activated | A queued install finished. |
| error | [mishka_installer.installer] install error: ... | A queued install failed. |
| error | [mishka_installer.installer] skipped re-loading ... on boot | A stored library could not be loaded again. It is also logged for each library that is already running when the store announces that it is ready again. |
| warning | [mishka_installer.installer] blocked by ... policy | The allow policy refused a call. |
| warning | [mishka_installer.installer] ... ships native artifacts | A package holds native files that must match the host. |
| info | [mishka_installer.mnesia] tables synchronized on ... | The store is ready on this node. It is logged again each time the store announces itself. |
| warning | [mishka_installer.mnesia] still loading [...] (large disc tables?); waiting... | Tables are still loading from disk. Raise :wait_timeout or :wait_retries for large tables. |
| critical | [mishka_installer.mnesia] tables still not available: [...] | The tables did not load within :wait_retries waits of :wait_timeout, and the store does not start. |
| critical | [mishka_installer.mnesia] tables unavailable: ... | Waiting for the tables returned an error, and the store does not start. |
| error | [mishka_installer.mnesia] could not create table ... | An essential table could not be created. |
| error | [mishka_installer.mnesia] essential ... exports no database_config/0 | A module listed in :essential defines no table, so none is created for it. |
| critical | [mishka_installer.mnesia] essential tables failed: [...] | One or more essential tables could not be created, and the store does not start. |
| warning | [mishka_installer.mnesia] no cluster node in [...] reachable yet; waiting to join when one connects | A joining node reached none of its configured nodes. It starts empty with the status :pending and joins when one connects. |
| error | [mishka_installer.mnesia] cluster join error: ...; will retry when a node connects | Connecting to the configured nodes returned an error. The node stays :pending. |
| error | [mishka_installer.mnesia] join did not complete: ...; will retry | The node connected but could not become a member or copy the essential tables. It stays :pending. |
| error | [mishka_installer.mnesia] could not copy table ... | A joining node could not copy an essential table from the cluster. |
| info | [mishka_installer.mnesia] joined cluster nodes: [...] | A joining node became a member and copied the essential tables. |
| info | [mishka_installer.mnesia] connected new cluster node: ... | A configured node connected after boot and was added to the store. |
| warning | [mishka_installer.mnesia] could not connect node ...: ... | A configured node connected, but adding it to the store failed. |
| warning | [mishka_installer.mnesia] health check found missing tables: [...] | The check that runs every 10 seconds did not find an essential table. The :health_check event reports the same. |
| critical | [mishka_installer.mnesia] split-brain: ... | The cluster needs an operator. |
| critical | [mishka_installer.mnesia] node mismatch: ... | The node name does not match the schema directory, and the store does not start. |
| warning | [mishka_installer.mnesia] node down: ... | A peer left. Nothing was removed. |
| error | [mishka_installer.mnesia] ... error: ... | A Mnesia call made by the library returned an error. The first part names the store or the table. |
| warning | [mishka_installer.mnesia] unexpected call from ..., unexpected cast: ... or unexpected info: ... | The store process received a message it does not handle and ignored it. A call gets no reply. |