You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by rs...@apache.org on 2022/01/07 01:56:24 UTC
[skywalking-rust] branch master updated: Fix examples in documentation and README (#6)
This is an automated email from the ASF dual-hosted git repository.
rshimizu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-rust.git
The following commit(s) were added to refs/heads/master by this push:
new bb13864 Fix examples in documentation and README (#6)
bb13864 is described below
commit bb138642b2757510fe65185315ab7e30280b2457
Author: dkkb <82...@users.noreply.github.com>
AuthorDate: Fri Jan 7 09:56:19 2022 +0800
Fix examples in documentation and README (#6)
---
README.md | 2 +-
examples/simple_trace_report.rs | 6 ++----
src/context/trace_context.rs | 4 +++-
src/reporter/grpc.rs | 9 ++++++---
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index ac106cd..be1bafe 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ async fn handle_request(reporter: ContextReporter) {
#[tokio::main]
async fn main() {
- let tx = Reporter::start("http://0.0.0.0:11800".to_string()).await;
+ let tx = Reporter::start("http://0.0.0.0:11800").await;
// Start server...
}
diff --git a/examples/simple_trace_report.rs b/examples/simple_trace_report.rs
index 6848475..6bcb39c 100644
--- a/examples/simple_trace_report.rs
+++ b/examples/simple_trace_report.rs
@@ -1,13 +1,11 @@
-use skywalking_rust::context::system_time::UnixTimeStampFetcher;
use skywalking_rust::context::trace_context::TracingContext;
use skywalking_rust::reporter::grpc::Reporter;
-use std::sync::Arc;
use tokio;
#[tokio::main]
async fn main() {
- let tx = Reporter::start("http://0.0.0.0:11800".to_string()).await;
- let mut context = TracingContext::default_internal("service", "instance");
+ let tx = Reporter::start("http://0.0.0.0:11800").await;
+ let mut context = TracingContext::default("service", "instance");
{
let span = context.create_entry_span("op1").unwrap();
context.finalize_span(span);
diff --git a/src/context/trace_context.rs b/src/context/trace_context.rs
index ee34b73..cea1725 100644
--- a/src/context/trace_context.rs
+++ b/src/context/trace_context.rs
@@ -32,6 +32,8 @@ use super::system_time::UnixTimeStampFetcher;
/// # Example
///
/// ```
+/// use skywalking_rust::context::trace_context::TracingContext;
+///
/// async fn handle_request() {
/// let mut ctx = TracingContext::default("svc", "ins");
/// {
@@ -43,7 +45,7 @@ use super::system_time::UnixTimeStampFetcher;
///
/// {
/// // Generates an Exit Span when executing an RPC.
-/// let span2 = ctx.create_exit_span("operation2").unwrap();
+/// let span2 = ctx.create_exit_span("operation2", "remote_peer").unwrap();
///
/// // Something...
///
diff --git a/src/reporter/grpc.rs b/src/reporter/grpc.rs
index 43f9664..c2b7a76 100644
--- a/src/reporter/grpc.rs
+++ b/src/reporter/grpc.rs
@@ -45,12 +45,15 @@ impl Reporter {
///
/// # Example
///
- /// ```
+ /// ```no_run
/// use tokio;
+ /// use skywalking_rust::context::trace_context::TracingContext;
+ /// use skywalking_rust::reporter::grpc::Reporter;
///
/// #[tokio::main]
- /// async fn main {
- /// let tx = Reporter::start("localhost:12800");
+ /// async fn main (){
+ /// let tx = Reporter::start("localhost:12800").await;
+ /// let mut context = TracingContext::default("service", "instance");
/// tx.send(context).await;
/// }
/// ```