Sys.Mon.Server (Hyper v0.1.0)

Copy Markdown View Source

Generic monitor process: drives a Sys.Mon.Sampler on a fixed period, folds each reading through a Controls.Ewma low-pass filter, and answers value/1.

Ticks self-schedule with Process.send_after after each sample completes, so a slow sample cannot let ticks pile up. dt for the filter is measured with System.monotonic_time/1, so the EWMA gain stays correct under jitter.

Summary

Functions

Returns a specification to start this module under a supervisor.

Force a single synchronous sample and return the resulting reading. Mainly for tests.

Start the monitor for sampler, registered under the sampler's own module name.

The latest instantaneous + filtered reading.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

sample_now(server)

@spec sample_now(GenServer.server()) :: Sys.Mon.Server.Reading.t()

Force a single synchronous sample and return the resulting reading. Mainly for tests.

start_link(sampler)

@spec start_link(module()) :: GenServer.on_start()

Start the monitor for sampler, registered under the sampler's own module name.

The sampler module fully describes the monitor: Sys.Mon.Server reads its schedule from period/0 and tau/0.

value(server)

The latest instantaneous + filtered reading.