pub struct RuntimeConfig {
pub num_worker_threads: Option<usize>,
pub max_blocking_threads: usize,
pub system_host: String,
pub system_port: u16,
pub system_enabled: bool,
pub starting_health_status: HealthStatus,
pub use_endpoint_health_status: Vec<String>,
pub system_health_path: String,
pub system_live_path: String,
pub health_check_enabled: bool,
pub canary_wait_time_secs: u64,
pub health_check_request_timeout_secs: u64,
}Expand description
Runtime configuration Defines the configuration for Tokio runtimes
Fields§
§num_worker_threads: Option<usize>Number of async worker threads If set to 1, the runtime will run in single-threaded mode Set this at runtime with environment variable DYN_RUNTIME_NUM_WORKER_THREADS. Defaults to number of cores.
max_blocking_threads: usizeMaximum number of blocking threads Blocking threads are used for blocking operations, this value must be greater than 0. Set this at runtime with environment variable DYN_RUNTIME_MAX_BLOCKING_THREADS. Defaults to 512.
system_host: StringSystem status server host for health and metrics endpoints Set this at runtime with environment variable DYN_SYSTEM_HOST
system_port: u16System status server port for health and metrics endpoints If set to 0, the system will assign a random available port Set this at runtime with environment variable DYN_SYSTEM_PORT
system_enabled: boolHealth and metrics System status server enabled Set this at runtime with environment variable DYN_SYSTEM_ENABLED
starting_health_status: HealthStatusStarting Health Status Set this at runtime with environment variable DYN_SYSTEM_STARTING_HEALTH_STATUS
use_endpoint_health_status: Vec<String>Use Endpoint Health Status When using endpoint health status, health status is the AND of individual endpoint health Set this at runtime with environment variable DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS with the list of endpoints to consider for system health
system_health_path: StringHealth endpoint paths Set this at runtime with environment variable DYN_SYSTEM_HEALTH_PATH
system_live_path: StringSet this at runtime with environment variable DYN_SYSTEM_LIVE_PATH
health_check_enabled: boolEnable active health checking with payloads Set this at runtime with environment variable DYN_HEALTH_CHECK_ENABLED
canary_wait_time_secs: u64Canary wait time in seconds (time to wait before sending health check when no activity) Set this at runtime with environment variable DYN_CANARY_WAIT_TIME
health_check_request_timeout_secs: u64Health check request timeout in seconds Set this at runtime with environment variable DYN_HEALTH_CHECK_REQUEST_TIMEOUT
Implementations§
Source§impl RuntimeConfig
impl RuntimeConfig
pub fn builder() -> RuntimeConfigBuilder
Sourcepub fn from_settings() -> Result<RuntimeConfig>
pub fn from_settings() -> Result<RuntimeConfig>
Load the runtime configuration from the environment and configuration files Configuration is priorities in the following order, where the last has the lowest priority:
- Environment variables (top priority) TO DO: Add documentation for configuration files. Paths should be configurable.
- /opt/dynamo/etc/runtime.toml
- /opt/dynamo/defaults/runtime.toml (lowest priority)
Environment variables are prefixed with DYN_RUNTIME_ and DYN_SYSTEM
Sourcepub fn system_server_enabled(&self) -> bool
pub fn system_server_enabled(&self) -> bool
Check if System server should be enabled System server is disabled by default, but can be enabled by setting DYN_SYSTEM_ENABLED to true
pub fn single_threaded() -> Self
Trait Implementations§
Source§impl Clone for RuntimeConfig
impl Clone for RuntimeConfig
Source§fn clone(&self) -> RuntimeConfig
fn clone(&self) -> RuntimeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeConfig
impl Debug for RuntimeConfig
Source§impl Default for RuntimeConfig
impl Default for RuntimeConfig
Source§impl<'de> Deserialize<'de> for RuntimeConfig
impl<'de> Deserialize<'de> for RuntimeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RuntimeConfig
impl Display for RuntimeConfig
Source§impl Serialize for RuntimeConfig
impl Serialize for RuntimeConfig
Source§impl Validate for RuntimeConfig
impl Validate for RuntimeConfig
Source§impl<'v_a> ValidateArgs<'v_a> for RuntimeConfig
impl<'v_a> ValidateArgs<'v_a> for RuntimeConfig
Auto Trait Implementations§
impl Freeze for RuntimeConfig
impl RefUnwindSafe for RuntimeConfig
impl Send for RuntimeConfig
impl Sync for RuntimeConfig
impl Unpin for RuntimeConfig
impl UnwindSafe for RuntimeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);