Skip to main content

DtraceLayer

Struct DtraceLayer 

Source
#[non_exhaustive]
pub struct DtraceLayer {}
Available on Linux only.
Expand description

DtraceLayer supports User Statically-Defined Tracing (USDT) on Linux.

Enable this experimental layer with features = ["layers-dtrace"] in Cargo.toml.

For now we have following probes:

§For Service

  1. ${operation}_start, arguments: path

    1. create_dir
    2. read
    3. write
    4. stat
    5. delete
    6. list
    7. presign
  2. ${operation}_end, arguments: path

    1. create_dir
    2. read
    3. write
    4. stat
    5. delete
    6. list
    7. presign

§For Reader

  1. reader_read_start, arguments: path, range
  2. reader_read_ok, arguments: path, range, length
  3. reader_read_error, arguments: path, range

§For Writer

  1. writer_write_start, arguments: path
  2. writer_write_ok, arguments: path, length
  3. writer_write_error, arguments: path
  4. writer_abort_start, arguments: path
  5. writer_abort_ok, arguments: path
  6. writer_abort_error, arguments: path
  7. writer_close_start, arguments: path
  8. writer_close_ok, arguments: path
  9. writer_close_error, arguments: path

Example:

// `Service` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::new(services::Memory::default().root("/tmp"))?
    .layer(DtraceLayer::new());

let path = "/tmp/test.txt";
for _ in 1..100000 {
    let bs = vec![0; 64 * 1024 * 1024];
    op.write(path, bs).await?;
    op.read(path).await?;
}

Then you can use readelf -n target/debug/examples/dtrace to see the probes:

Displaying notes found in: .note.stapsdt
  Owner                Data size        Description
  stapsdt              0x00000039       NT_STAPSDT (SystemTap probe descriptors)
    Provider: opendal
    Name: create_dir_start
    Location: 0x00000000000f8f05, Base: 0x0000000000000000, Semaphore: 0x00000000003649f8
    Arguments: -8@%rax
  stapsdt              0x00000037       NT_STAPSDT (SystemTap probe descriptors)
    Provider: opendal
    Name: create_dir_end
    Location: 0x00000000000f9284, Base: 0x0000000000000000, Semaphore: 0x00000000003649fa
    Arguments: -8@%rax
  stapsdt              0x0000003c       NT_STAPSDT (SystemTap probe descriptors)
    Provider: opendal
    Name: blocking_list_start
    Location: 0x00000000000f9487, Base: 0x0000000000000000, Semaphore: 0x0000000000364a28
    Arguments: -8@%rax
  stapsdt              0x0000003a       NT_STAPSDT (SystemTap probe descriptors)
    Provider: opendal
    Name: blocking_list_end
    Location: 0x00000000000f9546, Base: 0x0000000000000000, Semaphore: 0x0000000000364a2a
    Arguments: -8@%rax
  stapsdt              0x0000003c       NT_STAPSDT (SystemTap probe descriptors)

Implementations§

Source§

impl DtraceLayer

Source

pub fn new() -> Self

Create a new DtraceLayer.

Trait Implementations§

Source§

impl Clone for DtraceLayer

Source§

fn clone(&self) -> DtraceLayer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DtraceLayer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DtraceLayer

Source§

fn default() -> DtraceLayer

Returns the “default value” for a type. Read more
Source§

impl Layer for DtraceLayer

Source§

fn apply_service(&self, inner: Servicer) -> Servicer

Intercept the operation service stack. Read more
Source§

fn apply_context( &self, srv: Arc<dyn ServiceDyn>, inner: OperationContext, ) -> OperationContext

Intercept the operation context (HTTP transport and executor). Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> MaybeSend for T
where T: Send,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.