pub struct OpenTelemetryMetricsMiddleware { /* private fields */ }
Expand description
The middleware struct to be used in tide
Implementations§
Source§impl OpenTelemetryMetricsMiddleware
impl OpenTelemetryMetricsMiddleware
Sourcepub fn new(config: MetricsConfig) -> Self
pub fn new(config: MetricsConfig) -> Self
Instantiate the middleware
§Examples
let mut app = tide::new();
app.with(opentelemetry_tide::OpenTelemetryMetricsMiddleware::new(None));
app.at("/").get(|_| async { Ok("Metricized!") });
§with custom metrics configuration
let mut app = tide::new();
let mut config = opentelemetry_tide::MetricsConfig::default();
config.global_tags = Some(vec![opentelemetry::KeyValue::new("K","V")];)
app.with(opentelemetry_tide::OpenTelemetryMetricsMiddleware::new(config));
app.at("/").get(|_| async { Ok("Metricized!") });
Trait Implementations§
Source§impl<State: Clone + Send + Sync + 'static> Middleware<State> for OpenTelemetryMetricsMiddleware
impl<State: Clone + Send + Sync + 'static> Middleware<State> for OpenTelemetryMetricsMiddleware
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
req: Request<State>,
next: Next<'life1, State>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
req: Request<State>,
next: Next<'life1, State>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asynchronously handle the request, and return a response.
Auto Trait Implementations§
impl Freeze for OpenTelemetryMetricsMiddleware
impl !RefUnwindSafe for OpenTelemetryMetricsMiddleware
impl Send for OpenTelemetryMetricsMiddleware
impl Sync for OpenTelemetryMetricsMiddleware
impl Unpin for OpenTelemetryMetricsMiddleware
impl !UnwindSafe for OpenTelemetryMetricsMiddleware
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