Struct relay_cogs::Cogs
source · pub struct Cogs { /* private fields */ }
Expand description
COGS measurements collector.
The collector is cheap to clone.
Implementations§
source§impl Cogs
impl Cogs
sourcepub fn new<T>(recorder: T) -> Selfwhere
T: CogsRecorder + 'static,
pub fn new<T>(recorder: T) -> Selfwhere
T: CogsRecorder + 'static,
sourcepub fn noop() -> Self
pub fn noop() -> Self
Shortcut for creating a Cogs
from a crate::NoopRecorder
.
All collected measurements will be dropped.
source§impl Cogs
impl Cogs
sourcepub fn timed<F: Into<FeatureWeights>>(
&self,
resource: ResourceId,
weights: F,
) -> Token
pub fn timed<F: Into<FeatureWeights>>( &self, resource: ResourceId, weights: F, ) -> Token
Starts a recording for a COGS measurement.
When the returned token is dropped the measurement will be recorded with the configured recorder.
The recorded measurement can be attributed to multiple features by supplying a
weighted FeatureWeights
. A single AppFeature
attributes the entire measurement
to the feature.
§Example:
fn process_span(cogs: &Cogs, span: &mut Span) {
let _token = cogs.timed(ResourceId::Relay, AppFeature::Spans);
scrub_sql(span);
extract_tags(span);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cogs
impl !RefUnwindSafe for Cogs
impl Send for Cogs
impl Sync for Cogs
impl Unpin for Cogs
impl !UnwindSafe for Cogs
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)