Trace

Struct Trace 

Source
pub struct Trace { /* private fields */ }
Expand description

Inference object that provides custom tracing.

Is constructed with TraceHandler object that is activated each time an event occures.

Implementations§

Source§

impl Trace

Source

pub fn new_with_handle<H: TraceHandler, T: TensorTraceHandler>( parent_id: u64, activity_handler: Option<H>, tensor_activity_handler: Option<T>, ) -> Result<Self, Error>

Create a new inference trace object.

The activity_handler and tensor_activity_handler will be called to report activity including Trace::report_activity called by this trace as well as by every child traces that are spawned by this one. So the TraceHandler::trace_activity and TensorTraceHandler::trace_tensor_activity should check the trace object (first argument) that are passed to it to determine specifically what trace was reported.

level: The tracing level.
parent_id: The parent trace id for this trace. A value of 0 indicates that there is not parent trace.
activity_handler: The callback function where activity (on timeline event) for the trace (and all the child traces) is reported.
tensor_activity_handler: Optional callback function where activity (on tensor event) for the trace (and all the child traces) is reported.

Source

pub fn report_activity<N: AsRef<str>>( &self, timestamp: Duration, activity_name: N, ) -> Result<(), Error>

Report a trace activity. All the traces reported using this API will be send Activity::CustomActivity type.

timestamp The timestamp associated with the trace activity.
name The trace activity name.

Source

pub fn id(&self) -> Result<u64, Error>

Get the id associated with the trace. Every trace is assigned an id that is unique across all traces created for a Triton server.

Source

pub fn parent_id(&self) -> Result<u64, Error>

Get the parent id associated with the trace.
The parent id indicates a parent-child relationship between two traces. A parent id value of 0 indicates that there is no parent trace.

Source

pub fn model_name(&self) -> Result<String, Error>

Get the name of the model associated with the trace.

Source

pub fn model_version(&self) -> Result<i64, Error>

Get the version of the model associated with the trace.

Source

pub fn request_id(&self) -> Result<String, Error>

Get the request id associated with a trace. Returns the version of the model associated with the trace.

Source

pub fn spawn_child(&self) -> Result<Trace, Error>

Returns the child trace, spawned from the parent(self) trace.

Be causious: Trace is deleting on drop, so don’t forget to save it. Also do not use parent and child traces for different Requests: it can lead to Seq Faults.

Source

pub fn set_context(&mut self, context: String) -> Result<&mut Self, Error>

Set context to Triton Trace.

Source

pub fn context(&self) -> Result<String, Error>

Get Triton Trace context.

Trait Implementations§

Source§

impl PartialEq for Trace

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Trace

Auto Trait Implementations§

§

impl Freeze for Trace

§

impl !RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl !UnwindSafe for Trace

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.