commit | e1e4cb5584843a4b23ad274d7b2cf82826ab33c5 | [log] [tgz] |
---|---|---|
author | jmjoy <918734043@qq.com> | Sun Jul 03 22:33:05 2022 +0800 |
committer | GitHub <noreply@github.com> | Sun Jul 03 22:33:05 2022 +0800 |
tree | 052b8952ca8c7ad8ec1ef26167f18b985c0d1bc5 | |
parent | 25e4f28ef36afaacb8537d5de5d5e01bb89264fb [diff] |
Rename crate name skywalking_rust to skywalking? (#23) * Rename crate name skywalking_rust to skywalking. * Bump to 0.2.0.
SkyWalking Rust Agent provides observability capability for Rust App and Library, including tracing, metrics, topology map for distributed system and alert. It uses SkyWalking native formats and core concepts to keep best compatibility and performance.
All concepts are from the official SkyWalking definitions.
Span is an important and common concept in distributed tracing system. Learn Span from Google Dapper Paper. For better performance, we extend the span into 3 kinds.
Tag and Log are similar attributes of the span.
TracingContext is the context of the tracing process. Span should only be created through context, and be archived into the context after the span finished.
use skywalking::context::trace_context::TracingContext; use skywalking::reporter::grpc::Reporter; use tokio; async fn handle_request(reporter: ContextReporter) { let mut ctx = TracingContext::default("svc", "ins"); { // Generate an Entry Span when a request // is received. An Entry Span is generated only once per context. let span = ctx.create_entry_span("operation1").unwrap(); // Something... { // Generates an Exit Span when executing an RPC. let span2 = ctx.create_exit_span("operation2").unwrap(); // Something... ctx.finalize_span(span2); } ctx.finalize_span(span); } reporter.send(context).await; } #[tokio::main] async fn main() { let tx = Reporter::start("http://0.0.0.0:11800").await; // Start server... }
If you have skywalking-(VERSION).crate
, you can unpack it with the way as follows:
tar -xvzf skywalking-(VERSION).crate
Using cargo build
generates a library. If you'd like to verify the behavior, we recommend to use cargo run --example simple_trace_report
which outputs executable, then run it.
Apache 2.0