pub struct Observability { /* private fields */ }Available on crate features
config and config-observability only.Expand description
Open telemetry settings of a ProSA
See TelemetryFilter to configure a specific filter for ProSA processors.
use opentelemetry::global;
use prosa_utils::config::observability::Observability;
use prosa_utils::config::tracing::TelemetryFilter;
#[tokio::main]
async fn main() {
let observability_settings = Observability::default();
// trace
let filter = TelemetryFilter::default();
observability_settings.tracing_init(&filter);
}Implementations§
Source§impl Observability
impl Observability
Sourcepub fn new(level: TelemetryLevel) -> Observability
pub fn new(level: TelemetryLevel) -> Observability
Create an observability object with inline parameter instead of getting it from an external configuration
Sourcepub fn set_prosa_name(&mut self, name: &str)
pub fn set_prosa_name(&mut self, name: &str)
Setter of the ProSA name for all observability service.name attributes
Sourcepub fn get_scope_attributes(&self) -> Vec<KeyValue>
pub fn get_scope_attributes(&self) -> Vec<KeyValue>
Getter of the common scope attributes
Sourcepub fn get_logger_level(&self) -> TelemetryLevel
pub fn get_logger_level(&self) -> TelemetryLevel
Getter of the log level (max value)
Sourcepub fn build_meter_provider(&self, registry: &Registry) -> SdkMeterProvider
Available on crate feature config-observability-prometheus only.
pub fn build_meter_provider(&self, registry: &Registry) -> SdkMeterProvider
config-observability-prometheus only.Meter provider builder
Sourcepub fn build_logger_provider(&self) -> (SdkLoggerProvider, TelemetryLevel)
pub fn build_logger_provider(&self) -> (SdkLoggerProvider, TelemetryLevel)
Logger provider builder
Sourcepub fn build_tracer_provider(&self) -> SdkTracerProvider
pub fn build_tracer_provider(&self) -> SdkTracerProvider
Tracer provider builder
use opentelemetry::{global, trace::TracerProvider};
use prosa_utils::config::observability::Observability;
let otel_settings = Observability::default();
let tracer = otel_settings
.build_tracer_provider()
.tracer("prosa_proc_example");Sourcepub fn build_tracer(&self) -> Tracer
pub fn build_tracer(&self) -> Tracer
Tracer builder
use opentelemetry::{global, trace::Tracer};
use prosa_utils::config::observability::Observability;
let otel_settings = Observability::default();
let tracer = otel_settings
.build_tracer();Sourcepub fn tracing_init(&self, filter: &TelemetryFilter) -> Result<(), TryInitError>
pub fn tracing_init(&self, filter: &TelemetryFilter) -> Result<(), TryInitError>
Method to init tracing
Trait Implementations§
Source§impl Clone for Observability
impl Clone for Observability
Source§fn clone(&self) -> Observability
fn clone(&self) -> Observability
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 Observability
impl Debug for Observability
Source§impl Default for Observability
impl Default for Observability
Source§impl<'de> Deserialize<'de> for Observability
impl<'de> Deserialize<'de> for Observability
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Observability
impl RefUnwindSafe for Observability
impl Send for Observability
impl Sync for Observability
impl Unpin for Observability
impl UnsafeUnpin for Observability
impl UnwindSafe for Observability
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<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