Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(service/minitrace): update to v0.5.0 #2725

Merged
merged 4 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ madsim = { version = "0.2.21", optional = true }
md-5 = "0.10"
metrics = { version = "0.20", optional = true }
mini-moka = { version = "0.10", optional = true }
minitrace = { version = "0.4.1", optional = true }
minitrace = { version = "0.5", optional = true }
moka = { version = "0.10", optional = true, features = ["future"] }
once_cell = "1"
openssh = { version = "0.9.9", optional = true }
Expand Down
37 changes: 20 additions & 17 deletions core/src/layers/minitrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ use crate::*;
///
/// use anyhow::Result;
/// use futures::executor::block_on;
/// use minitrace::collector::Config;
/// use minitrace::prelude::*;
/// use opendal::layers::MinitraceLayer;
/// use opendal::services;
/// use opendal::Operator;
///
/// fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
/// let collector = {
/// let (span, collector) = minitrace::Span::root("op");
/// let reporter =
/// minitrace_jaeger::JaegerReporter::new("127.0.0.1:6831".parse().unwrap(), "opendal")
/// .unwrap();
/// minitrace::set_reporter(reporter, Config::default());
///
/// {
/// let root = Span::root("op", SpanContext::random());
/// let runtime = tokio::runtime::Runtime::new()?;
/// runtime.block_on(
/// async {
Expand All @@ -78,15 +85,12 @@ use crate::*;
/// op.stat("test").await.expect("must succeed");
/// op.read("test").await.expect("must succeed");
/// }
/// .in_span(Span::enter_with_parent("test", &span)),
/// .in_span(Span::enter_with_parent("test", &root)),
/// );
/// collector
/// };
/// let spans = block_on(collector.collect());
/// let bytes =
/// minitrace_jaeger::encode("opendal".to_owned(), rand::random(), 0, 0, &spans).unwrap();
/// minitrace_jaeger::report_blocking("127.0.0.1:6831".parse().unwrap(), &bytes)
/// .expect("report error");
/// }
///
/// minitrace::flush();
///
/// Ok(())
/// }
/// ```
Expand All @@ -99,14 +103,13 @@ use crate::*;
///
/// For example:
///
/// ```ignore
/// ```no_run
/// extern crate minitrace_jaeger;
///
/// let spans = block_on(collector.collect());
///
/// let bytes =
/// minitrace_jaeger::encode("opendal".to_owned(), rand::random(), 0, 0, &spans).unwrap();
/// minitrace_jaeger::report_blocking("127.0.0.1:6831".parse().unwrap(), &bytes).expect("report error");
/// let reporter =
/// minitrace_jaeger::JaegerReporter::new("127.0.0.1:6831".parse().unwrap(), "opendal")
/// .unwrap();
/// minitrace::set_reporter(reporter, Config::default());
/// ```
///
/// For real-world usage, please take a look at [`minitrace-datadog`](https://crates.io/crates/minitrace-datadog) or [`minitrace-jaeger`](https://crates.io/crates/minitrace-jaeger) .
Expand Down Expand Up @@ -145,7 +148,7 @@ impl<A: Accessor> LayeredAccessor for MinitraceAccessor<A> {
self.inner.info()
}

#[trace("create", enter_on_poll = true)]
#[trace(name = "create", enter_on_poll = true)]
async fn create_dir(&self, path: &str, args: OpCreateDir) -> Result<RpCreateDir> {
self.inner.create_dir(path, args).await
}
Expand Down