Skip to content

Commit

Permalink
feat: Add missing functions for trace layers (#2025)
Browse files Browse the repository at this point in the history
add missing functions for trace
  • Loading branch information
teckick authored Apr 17, 2023
1 parent 92e0aef commit 22eda0f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/src/layers/minitrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ impl<A: Accessor> LayeredAccessor for MinitraceAccessor<A> {
.await
}

#[trace("copy", enter_on_poll = true)]
async fn copy(&self, from: &str, to: &str, args: OpCopy) -> Result<RpCopy> {
self.inner().copy(from, to, args).await
}

#[trace("rename", enter_on_poll = true)]
async fn rename(&self, from: &str, to: &str, args: OpRename) -> Result<RpRename> {
self.inner().rename(from, to, args).await
}

#[trace("stat", enter_on_poll = true)]
async fn stat(&self, path: &str, args: OpStat) -> Result<RpStat> {
self.inner.stat(path, args).await
Expand Down Expand Up @@ -227,6 +237,16 @@ impl<A: Accessor> LayeredAccessor for MinitraceAccessor<A> {
})
}

#[trace("blocking_copy")]
fn blocking_copy(&self, from: &str, to: &str, args: OpCopy) -> Result<RpCopy> {
self.inner().blocking_copy(from, to, args)
}

#[trace("blocking_rename")]
fn blocking_rename(&self, from: &str, to: &str, args: OpRename) -> Result<RpRename> {
self.inner().blocking_rename(from, to, args)
}

#[trace("blocking_stat")]
fn blocking_stat(&self, path: &str, args: OpStat) -> Result<RpStat> {
self.inner.blocking_stat(path, args)
Expand Down
20 changes: 20 additions & 0 deletions core/src/layers/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ impl<A: Accessor> LayeredAccessor for TracingAccessor<A> {
.map(|(rp, r)| (rp, TracingWrapper::new(Span::current(), r)))
}

#[tracing::instrument(level = "debug", skip(self))]
async fn copy(&self, from: &str, to: &str, args: OpCopy) -> Result<RpCopy> {
self.inner().copy(from, to, args).await
}

#[tracing::instrument(level = "debug", skip(self))]
async fn rename(&self, from: &str, to: &str, args: OpRename) -> Result<RpRename> {
self.inner().rename(from, to, args).await
}

#[tracing::instrument(level = "debug", skip(self))]
async fn stat(&self, path: &str, args: OpStat) -> Result<RpStat> {
self.inner.stat(path, args).await
Expand Down Expand Up @@ -226,6 +236,16 @@ impl<A: Accessor> LayeredAccessor for TracingAccessor<A> {
.map(|(rp, r)| (rp, TracingWrapper::new(Span::current(), r)))
}

#[tracing::instrument(level = "debug", skip(self))]
fn blocking_copy(&self, from: &str, to: &str, args: OpCopy) -> Result<RpCopy> {
self.inner().blocking_copy(from, to, args)
}

#[tracing::instrument(level = "debug", skip(self))]
fn blocking_rename(&self, from: &str, to: &str, args: OpRename) -> Result<RpRename> {
self.inner().blocking_rename(from, to, args)
}

#[tracing::instrument(level = "debug", skip(self))]
fn blocking_stat(&self, path: &str, args: OpStat) -> Result<RpStat> {
self.inner.blocking_stat(path, args)
Expand Down

0 comments on commit 22eda0f

Please sign in to comment.