Skip to content

Commit 23ba02d

Browse files
committed
feat(system): enable the scheduler utilization metric in the dev server
The application has already booted by the time dev.exs runs, so setting the opt-in config there would be too late for the telemetry supervisor's init - the producer is started as an extra child instead, following the same pattern the script already uses to restart the Storage server with dev settings. Defaults to a 5s interval, overridable (or disabled with 0) via OBSERVER_WEB_SCHEDULER_UTILIZATION_INTERVAL_MS.
1 parent d8cc87d commit 23ba02d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

dev.exs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ Task.async(fn ->
9191
{telemetry_module, [mode: mode, data_retention_period: retention_period]}
9292
)
9393

94+
# The scheduler utilization metric is opt-in (see the installation guide) and the application
95+
# has already booted by the time this script runs, so the producer is started here as an extra
96+
# child of the telemetry supervisor. Set the interval to 0 to disable it.
97+
scheduler_interval_ms =
98+
"OBSERVER_WEB_SCHEDULER_UTILIZATION_INTERVAL_MS"
99+
|> System.get_env("5000")
100+
|> String.to_integer()
101+
102+
if scheduler_interval_ms > 0 do
103+
{:ok, _} =
104+
Supervisor.start_child(
105+
Observer.Web.Telemetry,
106+
{ObserverWeb.Telemetry.Producer.SchedulerWallTime, interval_ms: scheduler_interval_ms}
107+
)
108+
end
109+
94110
{:ok, _} = Supervisor.start_child(ObserverWeb.Application, WebDev.Endpoint)
95111

96112
Process.sleep(:infinity)

0 commit comments

Comments
 (0)