pub struct MetricsSet { /* private fields */ }Expand description
A snapshot of the metrics for a particular execution plan.
The set’s members remain fixed as execution registers more metrics, but their
values continue to reflect execution progress. Use Self::for_partition to
select the metrics belonging to one partition.
Implementations§
Source§impl MetricsSet
impl MetricsSet
Sourcepub fn push(&mut self, metric: Arc<Metric>)
pub fn push(&mut self, metric: Arc<Metric>)
Add the specified metric without changing other snapshots.
Sourcepub fn with_output_rows_skew(self) -> Self
pub fn with_output_rows_skew(self) -> Self
Returns this set with the derived output_rows_skew metric appended,
or unchanged if no partition reported output_rows yet.
This is typically used in ExecutionPlan::metrics of operators that
execute in multiple partitions (e.g. repartitions, partitioned joins and
aggregations), where it shows how evenly their output rows are spread
across partitions. With a single partition the skew is always 0%.
See BaselineMetrics::output_rows_skew_metric for how skew is computed.
Sourcepub fn for_partition(&self, partition: usize) -> Self
pub fn for_partition(&self, partition: usize) -> Self
Return the metrics whose partition ID equals partition.
Unpartitioned metrics are excluded; an unknown partition yields an empty set. Registration order and duplicates are preserved. Selected metrics share their current values with this set, but changes to either set’s membership do not affect the other.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Arc<Metric>>
pub fn iter(&self) -> impl Iterator<Item = &Arc<Metric>>
Returns an iterator across all metrics
Sourcepub fn output_rows(&self) -> Option<usize>
pub fn output_rows(&self) -> Option<usize>
Convenience: return the number of rows produced, aggregated
across partitions or None if no metric is present
Sourcepub fn spill_count(&self) -> Option<usize>
pub fn spill_count(&self) -> Option<usize>
Convenience: return the count of spills, aggregated
across partitions or None if no metric is present
Sourcepub fn spilled_bytes(&self) -> Option<usize>
pub fn spilled_bytes(&self) -> Option<usize>
Convenience: return the total byte size of spills, aggregated
across partitions or None if no metric is present
Sourcepub fn spilled_rows(&self) -> Option<usize>
pub fn spilled_rows(&self) -> Option<usize>
Convenience: return the total rows of spills, aggregated
across partitions or None if no metric is present
Sourcepub fn elapsed_compute(&self) -> Option<usize>
pub fn elapsed_compute(&self) -> Option<usize>
Convenience: return the amount of elapsed CPU time spent,
aggregated across partitions or None if no metric is present
Sourcepub fn sum<F>(&self, f: F) -> Option<MetricValue>
pub fn sum<F>(&self, f: F) -> Option<MetricValue>
Sums the values for metrics for which f(metric) returns
true, and returns the value. Returns None if no metrics match
the predicate.
Sourcepub fn sum_by_name(&self, metric_name: &str) -> Option<MetricValue>
pub fn sum_by_name(&self, metric_name: &str) -> Option<MetricValue>
Returns the sum of all the metrics with the specified name in the returned set.
Sourcepub fn aggregate_by_name(&self) -> Self
pub fn aggregate_by_name(&self) -> Self
Returns a new derived MetricsSet where all metrics
that had the same name have been
aggregated together. The resulting MetricsSet has all
metrics with Partition=None
Sourcepub fn sorted_for_display(self) -> Self
pub fn sorted_for_display(self) -> Self
Sort the order of metrics so the “most useful” show up first
Sourcepub fn timestamps_removed(self) -> Self
pub fn timestamps_removed(self) -> Self
Remove all timestamp metrics (for more compact display)
Sourcepub fn filter_by_metric_types(self, allowed: &[MetricType]) -> Self
pub fn filter_by_metric_types(self, allowed: &[MetricType]) -> Self
Returns a new derived MetricsSet containing only metrics whose
MetricType appears in allowed.
Sourcepub fn filter_by_categories(self, allowed: &[MetricCategory]) -> Self
pub fn filter_by_categories(self, allowed: &[MetricCategory]) -> Self
Returns a new MetricsSet filtered by MetricCategory.
- Metrics that declared a category are kept only when that
category appears in
allowed. - Metrics with no declared category are treated as
Uncategorizedfor filtering. - An empty
allowedslice means “plan only”: all metrics are removed.
Sourcepub fn filter_by_names(self, names: &[String]) -> Self
pub fn filter_by_names(self, names: &[String]) -> Self
Returns a new MetricsSet filtered by metric name.
Only metrics with the names appearing the list will be kept.
Trait Implementations§
Source§impl Clone for MetricsSet
impl Clone for MetricsSet
Source§impl Debug for MetricsSet
impl Debug for MetricsSet
Source§impl Default for MetricsSet
impl Default for MetricsSet
Source§impl Display for MetricsSet
impl Display for MetricsSet
Source§impl Extend<Arc<Metric>> for MetricsSet
impl Extend<Arc<Metric>> for MetricsSet
Source§fn extend<I: IntoIterator<Item = Arc<Metric>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Arc<Metric>>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<MetricsSet> for ExecutionPlanMetricsSet
impl From<MetricsSet> for ExecutionPlanMetricsSet
Source§fn from(metrics: MetricsSet) -> Self
fn from(metrics: MetricsSet) -> Self
Source§impl FromIterator<Arc<Metric>> for MetricsSet
impl FromIterator<Arc<Metric>> for MetricsSet
Source§impl IntoIterator for MetricsSet
impl IntoIterator for MetricsSet
Source§impl<'a> IntoIterator for &'a MetricsSet
impl<'a> IntoIterator for &'a MetricsSet
Auto Trait Implementations§
impl !RefUnwindSafe for MetricsSet
impl !UnwindSafe for MetricsSet
impl Forget for MetricsSet
impl Freeze for MetricsSet
impl Move for MetricsSet
impl Send for MetricsSet
impl Sync for MetricsSet
impl Unpin for MetricsSet
impl UnsafeUnpin for MetricsSet
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> 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 more