pub struct IoMetricsGroup { /* private fields */ }Expand description
I/O metrics of one thread, one IoMetrics per opted-in IoConfig.
A connection reports to the metrics of its configuration in the group that
was current on its thread when it was created, see
IoMetricsGroup::current and IoConfig::metrics. Connections created
with the same configuration on the thread share the metrics, for example
all connections accepted by one server listener on one worker.
A configuration has its own metrics if it was registered in the group with
IoMetricsGroup::register or enabled with
IoConfig::set_metrics. Connections of
other configurations report to the group’s shared
other metrics. Metrics are kept for the lifetime
of the group.
Implementations§
Source§impl IoMetricsGroup
impl IoMetricsGroup
Sourcepub fn new() -> Arc<IoMetricsGroup> ⓘ
pub fn new() -> Arc<IoMetricsGroup> ⓘ
Creates an empty group.
Sourcepub fn current() -> Arc<IoMetricsGroup> ⓘ
pub fn current() -> Arc<IoMetricsGroup> ⓘ
Returns the group of the current thread.
Each thread has its own group, created on first use, unless another
group was installed with IoMetricsGroup::set_current.
Sourcepub fn set_current(group: Arc<IoMetricsGroup>)
pub fn set_current(group: Arc<IoMetricsGroup>)
Installs group as the current thread’s group.
Connections created afterwards on this thread report to group,
existing connections keep reporting to the previous one.
The byte and write counters of IoMetrics are single-writer, install
a group on one thread at a time.
Sourcepub fn register(&self, cfg: &IoConfig)
pub fn register(&self, cfg: &IoConfig)
Gives cfg its own metrics in this group.
Connections created afterwards with cfg, on any thread whose current
group this is, report to these metrics instead of the shared
other metrics.
Sourcepub fn get(&self, cfg: &IoConfig) -> Arc<IoMetrics> ⓘ
pub fn get(&self, cfg: &IoConfig) -> Arc<IoMetrics> ⓘ
Returns the metrics cfg reports to.
These are the configuration’s own metrics if it is registered or has
metrics enabled, and the shared other metrics
otherwise.
Sourcepub fn other(&self) -> &Arc<IoMetrics> ⓘ
pub fn other(&self) -> &Arc<IoMetrics> ⓘ
Returns the metrics of connections whose configuration has no metrics of its own.
Sourcepub fn snapshot(&self) -> Vec<IoConfigMetrics>
pub fn snapshot(&self) -> Vec<IoConfigMetrics>
Returns snapshots of the metrics of configurations with their own
metrics, ordered by configuration id. See other for
the remaining connections.