pub struct ObsCallsite { /* private fields */ }Expand description
Static metadata for a single emit site. Constructed by codegen via
the const fn constructor — no heap allocation, no first-emit cost.
See spec 11 § 2.
Implementations§
Source§impl ObsCallsite
impl ObsCallsite
Sourcepub const fn new(
full_name: &'static str,
default_sev: Severity,
module: &'static str,
file: &'static str,
line: u32,
) -> ObsCallsite
pub const fn new( full_name: &'static str, default_sev: Severity, module: &'static str, file: &'static str, line: u32, ) -> ObsCallsite
Construct a callsite. Intended for use by codegen at static init; the const-fn shape means no heap allocation on first emit.
Sourcepub fn enabled(&self, current_gen: u32) -> EnabledOutcome
pub fn enabled(&self, current_gen: u32) -> EnabledOutcome
Hot-path enabled check.
Returns true if this callsite might fire (Sometimes /
Always); the caller is then expected to invoke
Observer::enabled only when the result is Sometimes.
current_gen is the observer’s generation(). On a generation
mismatch the cache is reset to Unknown and the caller re-probes.
Sourcepub fn cache(&self, interest: Interest, current_gen: u32)
pub fn cache(&self, interest: Interest, current_gen: u32)
Update the cached interest after probing the observer.
Sourcepub fn reset_cache(&self)
pub fn reset_cache(&self)
Force the cache to Unknown so the next emit re-probes. Used by
tests; production reload uses ObsCallsite::cache with the new
generation, which has the same effect.
Sourcepub const fn default_sev(&self) -> Severity
pub const fn default_sev(&self) -> Severity
Default severity declared by the schema.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ObsCallsite
impl RefUnwindSafe for ObsCallsite
impl Send for ObsCallsite
impl Sync for ObsCallsite
impl Unpin for ObsCallsite
impl UnsafeUnpin for ObsCallsite
impl UnwindSafe for ObsCallsite
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request