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: ProfilerConfigGlobal Joule Profiler configuration.
sources_config: HashMap<String, Value>Raw TOML values for each named metric source, keyed by source ID.
Implementations§
Source§impl ConfigTable
impl ConfigTable
Sourcepub fn new(global_config: GlobalConfig, sources: &[Source]) -> Self
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
sourcesCLI argument.
Sourcepub fn apply_cli(&mut self, cli: &mut CliArgs)
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.
Sourcepub fn build_source<R>(&mut self) -> Result<Option<R>>where
R: MetricReader,
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.
Sourcepub fn build_source_override<R>(
&mut self,
config_override_fn: impl FnOnce(&mut R::Config),
) -> Result<Option<R>>where
R: MetricReader,
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
impl ConfigTable
Sourcepub fn ensure_sources_are_known(&self) -> Result<()>
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.