pub struct Metric { /* private fields */ }
Expand description

Something that tracks a value of interest (metric) of a DataFusion super::ExecutionPlan execution.

Typically Metrics are not created directly, but instead are created using MetricBuilder or methods on ExecutionPlanMetricsSet.

 use datafusion::physical_plan::metrics::*;

 let metrics = ExecutionPlanMetricsSet::new();
 assert!(metrics.clone_inner().output_rows().is_none());

 // Create a counter to increment using the MetricBuilder
 let partition = 1;
 let output_rows = MetricBuilder::new(&metrics)
     .output_rows(partition);

 // Counter can be incremented
 output_rows.add(13);

 // The value can be retrieved directly:
 assert_eq!(output_rows.value(), 13);

 // As well as from the metrics set
 assert_eq!(metrics.clone_inner().output_rows(), Some(13));

Implementations

Create a new Metric. Consider using MetricBuilder rather than this function directly.

Create a new Metric. Consider using MetricBuilder rather than this function directly.

Add a new label to this metric

What labels are present for this metric?

return a reference to the value of this metric

return a mutable reference to the value of this metric

return a reference to the partition

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.