Skip to main content

MetricsSet

Struct MetricsSet 

Source
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

Source

pub fn new() -> Self

Create a new container of metrics

Source

pub fn push(&mut self, metric: Arc<Metric>)

Add the specified metric without changing other snapshots.

Source

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.

Source

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.

Source

pub fn iter(&self) -> impl Iterator<Item = &Arc<Metric>>

Returns an iterator across all metrics

Source

pub fn output_rows(&self) -> Option<usize>

Convenience: return the number of rows produced, aggregated across partitions or None if no metric is present

Source

pub fn spill_count(&self) -> Option<usize>

Convenience: return the count of spills, aggregated across partitions or None if no metric is present

Source

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

Source

pub fn spilled_rows(&self) -> Option<usize>

Convenience: return the total rows of spills, aggregated across partitions or None if no metric is present

Source

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

Source

pub fn sum<F>(&self, f: F) -> Option<MetricValue>
where F: FnMut(&Metric) -> bool,

Sums the values for metrics for which f(metric) returns true, and returns the value. Returns None if no metrics match the predicate.

Source

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.

Source

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

Source

pub fn sorted_for_display(self) -> Self

Sort the order of metrics so the “most useful” show up first

Source

pub fn timestamps_removed(self) -> Self

Remove all timestamp metrics (for more compact display)

Source

pub fn filter_by_metric_types(self, allowed: &[MetricType]) -> Self

Returns a new derived MetricsSet containing only metrics whose MetricType appears in allowed.

Source

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 Uncategorized for filtering.
  • An empty allowed slice means “plan only”: all metrics are removed.
Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MetricsSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MetricsSet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for MetricsSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Format the MetricsSet as a single string

Source§

impl Extend<Arc<Metric>> for MetricsSet

Source§

fn extend<I: IntoIterator<Item = Arc<Metric>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<MetricsSet> for ExecutionPlanMetricsSet

Source§

fn from(metrics: MetricsSet) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Arc<Metric>> for MetricsSet

Source§

fn from_iter<T: IntoIterator<Item = Arc<Metric>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl IntoIterator for MetricsSet

Source§

type Item = Arc<Metric>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<MetricsSet as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a MetricsSet

Source§

type Item = &'a Arc<Metric>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Arc<Metric>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.