#[non_exhaustive]pub struct ProducerConfig {
pub origin: Option<Producer>,
pub prefix: PathOwned,
pub node: Option<PathOwned>,
pub interval: Duration,
pub depth: usize,
}Expand description
Settings for a Producer. Construct with ProducerConfig::new and chain
the with_* setters (e.g.
ProducerConfig::new().with_origin(origin).with_prefix(".foo")), then hand it
to Producer::new.
With no origin set the resulting producer is a no-op: its registry is
disabled (bumps are dropped) and no task spawns. Call
ProducerConfig::with_origin to publish.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.origin: Option<Producer>Origin the stats broadcasts are created on.
When None, Producer::new spawns no task and publishes nothing.
prefix: PathOwnedTop-level path stats are published under (default .stats). The full
advertised path is <prefix>/node/<node> (or <prefix>/node when
node is unset). Also the registry’s exclude prefix, so serving a
stats broadcast doesn’t generate more stats.
node: Option<PathOwned>Node suffix that disambiguates broadcasts from different relays sharing a
cluster origin. Set this on every node in multi-relay deployments. May be
multi-segment (e.g. sjc/1, sjc/2) so a region with multiple hosts can
nest under a shared region key. An empty path is treated as unset.
Default none.
interval: DurationHow long the publish task waits between drains. Default 1s.
depth: usizeHow many leading broadcast-path segments to use as a grouping key.
Default 0 publishes one <prefix>/node/<node> broadcast carrying every
path. 1 publishes one broadcast per first segment at
<prefix>/<group>/node/<node>, and larger values include more leading
segments. Group broadcasts are announced while their group has live traffic;
at depth 0, the single broadcast stays announced for the producer’s life.
Implementations§
Source§impl ProducerConfig
impl ProducerConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
A config with default settings: no origin (no-op), .stats prefix, 1s
interval, and no node suffix. Call Self::with_origin to actually
publish.
Sourcepub fn with_origin(self, origin: impl Into<Option<Producer>>) -> Self
pub fn with_origin(self, origin: impl Into<Option<Producer>>) -> Self
Set the origin to publish the stats broadcast on. Without this the producer is a no-op.
Sourcepub fn with_prefix(self, prefix: impl Into<PathOwned>) -> Self
pub fn with_prefix(self, prefix: impl Into<PathOwned>) -> Self
Override the top-level prefix (default .stats).
Sourcepub fn with_interval(self, interval: Duration) -> Self
pub fn with_interval(self, interval: Duration) -> Self
Override the publish interval (default 1s).
Sourcepub fn with_node(self, node: impl Into<Option<PathOwned>>) -> Self
pub fn with_node(self, node: impl Into<Option<PathOwned>>) -> Self
Set the node suffix (default none). An empty path is treated as unset.
Sourcepub fn with_depth(self, depth: usize) -> Self
pub fn with_depth(self, depth: usize) -> Self
Set the grouping depth (default 0, a single broadcast). See Self::depth.
Trait Implementations§
Source§impl Clone for ProducerConfig
impl Clone for ProducerConfig
Source§fn clone(&self) -> ProducerConfig
fn clone(&self) -> ProducerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more