pub struct ResourceScope {
resources: HashMap<Vec<u8>, u16>,
scopes: HashMap<Vec<u8>, u16>,
res_id: UInt16Builder,
res_key: UInt64Builder,
res_dropped: UInt32Builder,
pub resource_attrs: AttrsBuilder,
pub scope_attrs: AttrsBuilder,
}Expand description
The resources + resource_attrs + scope_attrs arms of the star, shared
by every signal.
Interning is keyed on the canonical protobuf encoding of the Resource /
InstrumentationScope message. Storing the bytes rather than a hash means no
collision risk, and there are only a handful of distinct resources per block
so the memory is irrelevant.
Deliberately block-local. A process-wide resource dictionary would be shared mutable state on the ingest hot path, and it would break TTL-by-directory-drop — a block whose resource rows lived somewhere else could not be deleted by unlinking it.
Fields§
§resources: HashMap<Vec<u8>, u16>§scopes: HashMap<Vec<u8>, u16>§res_id: UInt16Builder§res_key: UInt64Builder§res_dropped: UInt32Builder§resource_attrs: AttrsBuilder§scope_attrs: AttrsBuilderImplementations§
Source§impl ResourceScope
impl ResourceScope
pub fn new() -> Self
Sourcepub fn has_headroom(
&self,
resources: usize,
scopes: usize,
res_kv: usize,
scope_kv: usize,
) -> bool
pub fn has_headroom( &self, resources: usize, scopes: usize, res_kv: usize, scope_kv: usize, ) -> bool
Whether this block can take resources more distinct resources,
scopes more distinct scopes, and their attributes.
pub fn is_empty(&self) -> bool
pub fn heap_bytes(&self) -> usize
pub fn resource(&mut self, res: Option<&Resource>) -> Result<u16>
pub fn scope(&mut self, scope: Option<&InstrumentationScope>) -> Result<u16>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResourceScope
impl RefUnwindSafe for ResourceScope
impl Send for ResourceScope
impl Sync for ResourceScope
impl Unpin for ResourceScope
impl UnsafeUnpin for ResourceScope
impl UnwindSafe for ResourceScope
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].