Skip to content

Commit

Permalink
Document WithRecorder<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed Oct 24, 2024
1 parent 3c4a7cb commit cc01249
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions query-engine/metrics/src/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ pub trait WithMetricsInstrumentation: Sized {

impl<T> WithMetricsInstrumentation for T {}

/// A type instrumented with a metric recorder.
///
/// If `T` is a `Future`, then `WithRecorder<T>` is also a `Future`. When polled, it temporarily
/// sets the local metric recorder for the duration of polling the inner future, and then restores
/// the previous recorder on the stack.
///
/// Similar logic can be implemented for cases where `T` is another async primitive like a stream
/// or a sink, or any other type where such instrumentation makes sense (e.g. function).
#[pin_project]
pub struct WithRecorder<T> {
#[pin]
Expand Down

0 comments on commit cc01249

Please sign in to comment.