pub struct Config {
pub endpoints: Vec<String>,
pub client_type: ClientType,
pub recording_enabled: bool,
pub recording_path: Option<String>,
pub recording_flush_interval: Option<Duration>,
pub default_resolution: TimestampResolution,
pub element_kinds: Vec<ElementKindRegistration>,
pub metric_definitions: Vec<MetricDefinition>,
pub initialization_interval: Option<Duration>,
pub cluster_monitor_interval: Option<Duration>,
pub max_reg_elem_retries: usize,
}
Expand description
Configuration settings for the Muse client.
The Config
struct contains all necessary parameters to initialize the Muse client.
Fields§
§endpoints: Vec<String>
List of endpoint URLs for the Muse client.
client_type: ClientType
The type of client to use (Poet
or Mock
).
recording_enabled: bool
Enables event recording if set to true
.
recording_path: Option<String>
File path for recording events (required if recording_enabled
is true
).
recording_flush_interval: Option<Duration>
Interval for flushing the recorder when recording is enabled.
default_resolution: TimestampResolution
Default timestamp resolution for metrics.
element_kinds: Vec<ElementKindRegistration>
List of element kinds to register upon initialization.
metric_definitions: Vec<MetricDefinition>
List of metric definitions available for reporting.
initialization_interval: Option<Duration>
Interval for initialization tasks (optional).
cluster_monitor_interval: Option<Duration>
Interval for cluster monitoring tasks (optional).
max_reg_elem_retries: usize
Maximum number of retries for element registration.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(
endpoints: Vec<String>,
client_type: ClientType,
recording_enabled: bool,
recording_path: Option<String>,
recording_flush_interval: Option<Duration>,
default_resolution: TimestampResolution,
element_kinds: Vec<ElementKindRegistration>,
metric_definitions: Vec<MetricDefinition>,
initialization_interval: Option<Duration>,
cluster_monitor_interval: Option<Duration>,
max_reg_elem_retries: usize,
) -> MuseResult<Self>
pub fn new( endpoints: Vec<String>, client_type: ClientType, recording_enabled: bool, recording_path: Option<String>, recording_flush_interval: Option<Duration>, default_resolution: TimestampResolution, element_kinds: Vec<ElementKindRegistration>, metric_definitions: Vec<MetricDefinition>, initialization_interval: Option<Duration>, cluster_monitor_interval: Option<Duration>, max_reg_elem_retries: usize, ) -> MuseResult<Self>
Creates a new Config
instance with the provided settings.
§Arguments
endpoints
: A vector of endpoint URLs.client_type
: The client type to use.recording_enabled
: Enables event recording.recording_path
: File path for recording events.recording_flush_interval
: Interval to flush recording events.default_resolution
: Default timestamp resolution.element_kinds
: Element kinds to register.metric_definitions
: Metric definitions for reporting.initialization_interval
: Interval for the initialization task.cluster_monitor_interval
: Interval for cluster monitoring.max_reg_elem_retries
: Max retries for element registration.
§Errors
Returns a MuseError::Configuration
if validation fails.
§Examples
use ih_muse_core::prelude::*;
use ih_muse_proto::prelude::*;
let config = Config::new(
vec!["http://localhost:8080".to_string()],
ClientType::Poet,
false,
None,
None,
TimestampResolution::Milliseconds,
vec![ElementKindRegistration::new("kind_code", Some("parent_code"), "kind_name", "description")],
vec![MetricDefinition::new("metric_code", "metric_name", "description")],
Some(std::time::Duration::from_secs(60)),
Some(std::time::Duration::from_secs(60)),
3,
).expect("Failed to create config");
Sourcepub fn validate(&self) -> MuseResult<()>
pub fn validate(&self) -> MuseResult<()>
Validates the configuration settings.
Ensures all required fields are properly set.
§Errors
Returns a MuseError::Configuration
if any validation check fails.