Skip to main content

ConfigTable

Struct ConfigTable 

Source
pub struct ConfigTable {
    pub profiler_config: ProfilerConfig,
    pub sources_config: HashMap<String, Value>,
    /* private fields */
}
Expand description

The structure used to resolve sources from toml configuration and the profiler config.

Fields§

§profiler_config: ProfilerConfig

Global Joule Profiler configuration.

§sources_config: HashMap<String, Value>

Raw TOML values for each named metric source, keyed by source ID.

Implementations§

Source§

impl ConfigTable

Source

pub fn new(global_config: GlobalConfig, sources: &[Source]) -> Self

Creates a new ConfigTable from a GlobalConfig and the sources enabled from the CLI.

The enabled_sources set is the union of:

  • sources declared in the global config file, and
  • sources passed directly via the sources CLI argument.
Source

pub fn apply_cli(&mut self, cli: &mut CliArgs)

Applies every CLI override of the global (profiler-level) configuration in one pass, so ConfigTable::to_config can read profiler_config directly afterwards instead of re-merging cli itself.

Only the flags that have no configuration key of their own go through here: the -D overrides are already merged into the configuration before the table is built.

Source

pub fn build_source<R>(&mut self) -> Result<Option<R>>
where R: MetricReader,

Builds a metric source reader using the provided configuration into the config table, or default configuration if not configured.

It returns an error if the source initialization fails and ignore_on_failure is not set.

Source

pub fn build_source_override<R>( &mut self, config_override_fn: impl FnOnce(&mut R::Config), ) -> Result<Option<R>>
where R: MetricReader,

Builds a metric source reader, applying an external config override through a caller-supplied closure before construction.

It returns an error if the source initialization fails and ignore_on_failure is not set.

Source§

impl ConfigTable

Source

pub fn ensure_sources_are_known(&self) -> Result<()>

Errors on the configured sources no registered source claimed.

Must be called once every source has been registered: build_source takes its own section out of the table, so what is left can only be misspelled source names.

Source

pub fn to_config(self, cli: CliArgs) -> Result<Config>

Consumes the ConfigTable and a final CliArgs to produce the core Config.

Returns an error if the configuration is invalid.

Trait Implementations§

Source§

impl Debug for ConfigTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MetricReaderTypeBound for T
where T: Send,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.