NAME
Developer::Dashboard::Guide::Collectors - working with collectors
DESCRIPTION
Collectors are the scheduled checks whose results feed the browser pages and the shell prompt. This guide covers how they are defined, run and managed.
This guide is part of the Developer::Dashboard manual. The main page is the front door for the whole set.

The picture shows the collector flow in five steps: you define a collector in config, the runner runs it on its interval, the store keeps the latest result, and the result shows in two places, the browser pages and the shell prompt.

The picture is a real terminal session. Two collectors are defined, both report ok health, and the second command prints the latest stored output of the disk collector.
Working With Collectors
Ensure the home config file exists without seeding collectors:
d2 config init
If config/config.json is missing, that command creates it as:
{}
It does not inject an example collector, and if the file already exists it is left untouched.
List collector status:
d2 collector list
d2 collector status shell.example
Inspect collector logs:
d2 collector log
d2 collector log shell.example
d2 collector log prints the known collector log streams. d2 collector log <name> prints one collector transcript.
If a configured collector has not run yet, the command prints an explicit no-log message instead of blank output. d2 collector status <name> now also exposes watchdog metadata for managed loops, including watchdog_restart_count, watchdog_last_unexpected_stop_at, watchdog_last_restart_at, and watchdog_attention_required, so repeated collector crashes are visible instead of looking like silent disappearance.
Collector status timestamps and collector log headers use the machine's local system time with an explicit numeric timezone offset such as +0100, so the visible timestamps line up with cron scheduling on the same machine instead of looking one hour behind during daylight-saving transitions.
Collector jobs support two execution fields:
commandruns a shell command string through the native platform shell:sh -lcon Unix-like systems and PowerShell on Windowscoderuns Perl code directly inside the collector runtime
A collector may use interval polling or a standard five-field local-time cron expression in config/config.json. The fields are minute, hour, day-of-month, month, and day-of-week.
Numeric values, comma-separated lists, ranges, range steps, */step, and case-insensitive month and weekday names are supported. When both day-of-month and day-of-week are restricted, either matching field makes the date due, following crontab semantics.
To run once at the start of every hour, use 0 */1 * * *: the first field is the minute, so 0 selects minute zero, and */1 in the second field selects every hour. Do not use * */1 * * * for an hourly run. Its first field is *, which matches every minute, so it runs once per minute throughout each hour.
An explicit schedule value takes precedence over inferred scheduling; use "schedule": "cron" with cron when you want to state the mode explicitly.
Missing or malformed cron expressions are rejected when the loop starts rather than running once per scheduler poll.
For example, run a report at 09:00 on weekdays:
{
"collectors": [
{
"name": "weekday.report",
"command": "./report",
"cwd": "home",
"cron": "0 9 * * MON-FRI"
}
]
}
Cron loops poll once per second and deduplicate execution within each matching minute. They use the machine's local time and timezone.
A collector's cwd may be an absolute or relative directory, a built-in directory accessor such as home, a configured path_aliases name, or a skill-qualified Folder.pm alias such as collectorpaths.workspace. Config aliases take precedence over skill-provided aliases. The latter are resolved read-only from the installed skill's lib/Folder.pm using the same method rules as d2 path resolve.
The built-in housekeeper collector is always present even when config/config.json is otherwise empty. It runs every 900 seconds with Perl code instead of a shell command, so it does not depend on PATH resolution.
That collector removes stale hashed runtime state roots from the shared temp tree under /tmp/<user>/developer-dashboard/state/ and removes older developer-dashboard-ajax-* temp files plus dashboard-result-* runtime result temp files left behind in /tmp/. It also rotates collector log transcripts when a collector defines rotation or rotations.
lines keeps the trailing line count, while minute, minutes, hour, hours, day, days, week, weeks, month, and months keep only log entries newer than the requested retention window. Both rules cut on entry boundaries, so a rotated transcript always starts at a complete entry header: a line budget drops whole entries rather than slicing one in half, and a budget smaller than the newest entry empties the transcript instead of leaving a headerless fragment behind.
Run it on demand with:
d2 housekeeper
d2 collector run housekeeper
If you need different cadence or behaviour, define your own collector named housekeeper in config. That override now inherits the built-in code and cwd defaults, so changing only interval or adding indicator metadata is enough:
{
"collectors": [
{
"name": "housekeeper",
"interval": 60,
"indicator": {
"icon": "🧹"
}
}
]
}
Example collector definitions:
{
"collectors": [
{
"name": "shell.example",
"command": "printf 'shell collector\n'",
"cwd": "home",
"interval": 60
},
{
"name": "perl.example",
"code": "print qq(perl collector\n); return 0;",
"cwd": "home",
"interval": 60,
"indicator": {
"icon": "P"
}
},
{
"name": "foobar",
"command": "./foobar",
"cwd": "home",
"interval": 10,
"mode": "multiple",
"multiple": 3,
"rotation": {
"lines": 100,
"days": 1
},
"indicator": {
"name": "foobar.indicator",
"label": "Foobar",
"icon": "[% a %]"
}
}
]
}
Collector concurrency defaults are explicit:
When
modeis omitted, the collector runs insingletonmode.In
singletonmode, the scheduler skips a due run while an older run of the same collector is still active.In
multiplemode, the scheduler still starts due runs while older runs are active, but only untilmultipleactive runs are already in flight.When
modeismultipleandmultipleis omitted, the runtime uses2.Collectors whose
commandre-entersd2through a shell path now have a safety floor of30seconds even if config asks for a smaller interval, because those recursive dashboard collectors are materially heavier than direct shell probes. Setallow_fast_pollorallow_fast_dashboard_pollon that collector, or setDEVELOPER_DASHBOARD_MIN_DASHBOARD_COMMAND_INTERVAL_SECONDS, when the faster cadence is intentional and understood.When a collector sets
disable => 1or"disable": true, dashboard will not start that collector, explicit named starts reject it, and any already-running managed loop for that collector is stopped during the next collector lifecycle action. Managed indicator state for that collector is also removed instead of lingering as if it were still active.The flag is read by its truth value, so a JSON literal
false(or0,"false","no","off") keeps the collector enabled whiletrueand any other non-empty value disable it;"disable": falseis not a disabled collector.Stopping a singleton collector loop also terminates the long-running command currently owned by that loop, so
d2 collector stop foodoes not leave the old worker command alive behind the stopped dispatcher.
Collector indicators follow the collector exit code automatically: 0 stores an ok indicator state and any non-zero exit code stores error. When indicator.name is omitted, the collector name is reused automatically.
When indicator.label is omitted, it defaults to that same name. Configured collector indicators are seeded immediately, so prompt and page status strips show them before the first collector run.
Before a collector has produced real output it appears as missing.
Prompt output renders an explicit status glyph in front of the collector icon, so successful checks show fragments such as ✅🔑 while failing or not-yet-run checks show fragments such as 🚨🔑. Under DD-OOP-LAYERS, a deeper child layer no longer pins an inherited collector indicator at that default missing placeholder just because the child runtime has its own .developer-dashboard/ folder.
If the child layer does not override that collector config and only has the placeholder state, dashboard now falls back to the nearest inherited real collector state such as a parent-layer ok result instead of turning the same indicator red.
The top-right browser status strip now uses that same configured icon instead of falling back to the collector name, and stale managed indicators are removed automatically if the collector config is renamed. The browser chrome now uses an emoji-capable font stack there as well, so UTF-8 icons such as 🐳 and 💰 remain visible instead of collapsing into fallback boxes.
For TT-backed collector icons, a collector such as ./foobar can print {"a":123} on stdout; the runner decodes that JSON into Perl data and renders [% a %] into the live icon 123.
Later config-sync passes keep the configured icon_template metadata and the already-rendered live icon, so commands such as d2 indicator list and d2 ps1 do not revert the persisted icon back to raw [% ... %] text between runs. The blank-environment integration flow also keeps a regression for mixed collector health: one intentionally broken Perl collector must stay red without stopping a second healthy collector from staying green in d2 indicator list, d2 ps1, and /system/status.