Struct datafusion::physical_plan::metrics::Metric
source · [−]pub struct Metric { /* private fields */ }
Expand description
Something that tracks a value of interest (metric) of a DataFusion
super::ExecutionPlan
execution.
Typically Metric
s 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
sourceimpl Metric
impl Metric
sourcepub fn new(value: MetricValue, partition: Option<usize>) -> Self
pub fn new(value: MetricValue, partition: Option<usize>) -> Self
Create a new Metric
. Consider using MetricBuilder
rather than this function directly.
sourcepub fn new_with_labels(
value: MetricValue,
partition: Option<usize>,
labels: Vec<Label>
) -> Self
pub fn new_with_labels(
value: MetricValue,
partition: Option<usize>,
labels: Vec<Label>
) -> Self
Create a new Metric
. Consider using MetricBuilder
rather than this function directly.
sourcepub fn value(&self) -> &MetricValue
pub fn value(&self) -> &MetricValue
return a reference to the value of this metric
sourcepub fn value_mut(&mut self) -> &mut MetricValue
pub fn value_mut(&mut self) -> &mut MetricValue
return a mutable reference to the value of this metric
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Metric
impl Send for Metric
impl Sync for Metric
impl Unpin for Metric
impl !UnwindSafe for Metric
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more