pub struct TelemetryFilter { /* private fields */ }
Available on crate features
config
and config-observability
only.Expand description
Structure to define ProSA telemetry filter
use prosa_utils::config::observability::Observability;
use prosa_utils::config::tracing::TelemetryFilter;
use prosa_utils::config::tracing;
use tracing_subscriber::filter;
// Create telemetry filter with a DEBUG level
let mut telemetry_filter = TelemetryFilter::new(filter::LevelFilter::DEBUG);
// Specific processor log level shouldn't be greater than the global telemetry filter level
telemetry_filter.add_proc_filter(String::from("prosa_test_proc"), filter::LevelFilter::INFO);
let otel_settings = Observability::default();
otel_settings.tracing_init(&telemetry_filter);
Implementations§
Source§impl TelemetryFilter
impl TelemetryFilter
Sourcepub fn new(level: LevelFilter) -> TelemetryFilter
pub fn new(level: LevelFilter) -> TelemetryFilter
Method to create a new telemetry filter
Sourcepub fn clone_with_level(&self, level: TelemetryLevel) -> TelemetryFilter
pub fn clone_with_level(&self, level: TelemetryLevel) -> TelemetryFilter
Method to clone the telemetry filter and change its default level if it’s less verbose
Sourcepub fn add_proc_filter(&mut self, proc_name: String, level: LevelFilter)
pub fn add_proc_filter(&mut self, proc_name: String, level: LevelFilter)
Method to add a filter on a specific processor
Trait Implementations§
Source§impl Clone for TelemetryFilter
impl Clone for TelemetryFilter
Source§fn clone(&self) -> TelemetryFilter
fn clone(&self) -> TelemetryFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TelemetryFilter
impl Debug for TelemetryFilter
Source§impl Default for TelemetryFilter
impl Default for TelemetryFilter
Source§fn default() -> TelemetryFilter
fn default() -> TelemetryFilter
Returns the “default value” for a type. Read more
Source§impl<S> Filter<S> for TelemetryFilter
impl<S> Filter<S> for TelemetryFilter
Source§fn enabled(&self, metadata: &Metadata<'_>, _: &Context<'_, S>) -> bool
fn enabled(&self, metadata: &Metadata<'_>, _: &Context<'_, S>) -> bool
Returns
true
if this layer is interested in a span or event with the
given Metadata
in the current Context
, similarly to
Subscriber::enabled
. Read moreSource§fn callsite_enabled(&self, metadata: &'static Metadata<'static>) -> Interest
fn callsite_enabled(&self, metadata: &'static Metadata<'static>) -> Interest
Source§fn event_enabled(&self, event: &Event<'_>, _: &Context<'_, S>) -> bool
fn event_enabled(&self, event: &Event<'_>, _: &Context<'_, S>) -> bool
Called before the filtered [
Layer]'s [
on_event], to determine if
on_event` should be called. Read moreSource§fn max_level_hint(&self) -> Option<LevelFilter>
fn max_level_hint(&self) -> Option<LevelFilter>
Source§fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Source§fn on_enter(&self, id: &Id, ctx: Context<'_, S>)
fn on_enter(&self, id: &Id, ctx: Context<'_, S>)
Notifies this filter that a span with the given ID was entered. Read more
Auto Trait Implementations§
impl Freeze for TelemetryFilter
impl RefUnwindSafe for TelemetryFilter
impl Send for TelemetryFilter
impl Sync for TelemetryFilter
impl Unpin for TelemetryFilter
impl UnwindSafe for TelemetryFilter
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§impl<F, S> FilterExt<S> for Fwhere
F: Filter<S>,
impl<F, S> FilterExt<S> for Fwhere
F: Filter<S>,
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>
Wrap the input message
T
in a tonic::Request