[−][src]Struct opentracingrust::tracers::FileTracer
A tracer that writes spans to an std::io::Write
.
Useful for local testing, experiments, tests. NOT suited for production use!
Intended to write spans to stderr but can also be used to write spans to stdout or files.
Examples
extern crate opentracingrust; use std::io; use std::time::Duration; use opentracingrust::FinishedSpan; use opentracingrust::tracers::FileTracer; use opentracingrust::utils::GlobalTracer; use opentracingrust::utils::ReporterThread; fn main() { let (tracer, receiver) = FileTracer::new(); GlobalTracer::init(tracer); let reporter = ReporterThread::new_with_duration( receiver, Duration::from_millis(50), |span| { let mut stderr = io::stderr(); FileTracer::write_trace(span, &mut stderr).unwrap(); } ); // ... snip ... }
Methods
impl FileTracer
[src]
pub fn new() -> (Tracer, SpanReceiver)
[src]
Instantiate a new file tracer.
pub fn write_trace<W: Write>(span: FinishedSpan, file: &mut W) -> Result<()>
[src]
Function to write a FinishedSpan
to a stream.
Used to send FinishedSpan
s to an std::io::Write
stream.
Trait Implementations
impl TracerInterface for FileTracer
[src]
fn extract(&self, fmt: ExtractFormat) -> Result<Option<SpanContext>>
[src]
Extract a span context from a text map or HTTP headers.
Note that the binary extraction format is not supported by FileTracer
.
fn inject(&self, context: &SpanContext, fmt: InjectFormat) -> Result<()>
[src]
Inject the span context into a text map or HTTP headers.
Note that the binary injection format is not supported by FileTracer
.
fn span(&self, name: &str, options: StartOptions) -> Span
[src]
Auto Trait Implementations
impl Sync for FileTracer
impl Unpin for FileTracer
impl Send for FileTracer
impl RefUnwindSafe for FileTracer
impl UnwindSafe for FileTracer
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,