How the Error Reports extension is configured.
config :nerves_hub_link,
error_reports: [
max_reports: 100,
interval_seconds: 60,
context: {MyApp.Telemetry, :error_context, []}
]Turning error reports on is naming the module in extension_modules, not a
key here.
Summary
Functions
Device state to attach to every report, as a string map.
How long to buffer before sending, in milliseconds.
How many reports to hold before dropping the oldest.
Functions
Device state to attach to every report, as a string map.
Uptime by default, because it is the one thing every runtime can answer
cheaply. Anything else is device-specific, and reading it is not free: the
health extension shells out to free for memory, which is not something to
do in the middle of a crash.
So the rest is yours to supply. Point :context at a function returning a
map and it is merged over the default:
config :nerves_hub_link,
error_reports: [context: {MyApp.Telemetry, :error_context, []}]
def error_context() do
%{"reboot_count" => Nerves.Runtime.KV.get("nerves_fw_validated"), "site" => "depot-4"}
endKeys named uptime_ms, free_memory_bytes and reboot_count are given
units in the NervesHub UI. Everything else is shown as it arrives.
Called on the extension's own process when a batch is sent, never in the process that crashed. A function that raises costs the report its context and nothing else.
@spec interval() :: pos_integer()
How long to buffer before sending, in milliseconds.
Never less than 60 seconds, whatever is configured.
@spec max_reports() :: pos_integer()
How many reports to hold before dropping the oldest.