Monitor

Monitor combines Tracer, Collector and Filter by Manager to provide an entry point for the polling, filtering and collecting of the data.

Poller is used to poll the data periodically.

class duetector.monitors.base.Monitor(config: dict[str, Any] | None = None, *args, **kwargs)[source]

Bases: Configuable

A base class for all monitors

A monitor is a collection of tracers, filters and collectors, record host and tracer, provide a way to poll data

property backend_args

Config for self._backend_imp.

collectors: list[Collector]

A list of collectors, should be initialized by CollectorManager

config_scope: str | None = 'monitor'

Config scope for monitor.

default_config = {'backend_args': {'max_workers': 10}, 'disabled': False, 'poller': {'call_when_shutdown': True, 'interval_ms': 500}}

Default config for monitor.

Two sub-configs are available:
  • backend_args: config for self._backend_imp

  • poller: config for Poller

property disabled

If disabled, no tracers, filters, collectors will be initialized.

filters: list[Filter]

A list of filters, should be initialized by FilterManager

injectors: list[Injector]

A list of collectors, should be initialized by InjectorManager

poll(tracer: Tracer)[source]

Poll a tracer. Should be implemented by subclass.

poll_all()[source]

Poll all tracers. Depends on self.poll.

shutdown()[source]

Shutdown the monitor.

start_polling()[source]

Start polling. Poller will call self.poll_all periodically.

summary() dict[source]

Get a summary of all collectors.

tracers: list[Tracer]

A list of tracers, should be initialized by TracerManager

Avaliable Monitor