#[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
-
${operation}_start, arguments: path
- create_dir
- read
- write
- stat
- delete
- list
- presign
-
${operation}_end, arguments: path
- create_dir
- read
- write
- stat
- delete
- list
- presign
§For Reader
- reader_read_start, arguments: path, range
- reader_read_ok, arguments: path, range, length
- reader_read_error, arguments: path, range
§For Writer
- writer_write_start, arguments: path
- writer_write_ok, arguments: path, length
- writer_write_error, arguments: path
- writer_abort_start, arguments: path
- writer_abort_ok, arguments: path
- writer_abort_error, arguments: path
- writer_close_start, arguments: path
- writer_close_ok, arguments: path
- 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
impl DtraceLayer
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new DtraceLayer.
Trait Implementations§
Source§impl Clone for DtraceLayer
impl Clone for DtraceLayer
Source§fn clone(&self) -> DtraceLayer
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DtraceLayer
impl Debug for DtraceLayer
Source§impl Default for DtraceLayer
impl Default for DtraceLayer
Source§fn default() -> DtraceLayer
fn default() -> DtraceLayer
Returns the “default value” for a type. Read more
Source§impl Layer for DtraceLayer
impl Layer for DtraceLayer
Source§fn apply_service(&self, inner: Servicer) -> Servicer
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
fn apply_context( &self, srv: Arc<dyn ServiceDyn>, inner: OperationContext, ) -> OperationContext
Intercept the operation context (HTTP transport and executor). Read more
Auto Trait Implementations§
impl Freeze for DtraceLayer
impl RefUnwindSafe for DtraceLayer
impl Send for DtraceLayer
impl Sync for DtraceLayer
impl Unpin for DtraceLayer
impl UnsafeUnpin for DtraceLayer
impl UnwindSafe for DtraceLayer
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