commit | 9f777ed76c816abd118f43c5a5a218f8c4b2ed3c | [log] [tgz] |
---|---|---|
author | jmjoy <918734043@qq.com> | Sat Jul 23 10:35:57 2022 +0800 |
committer | GitHub <noreply@github.com> | Sat Jul 23 10:35:57 2022 +0800 |
tree | 17d9bd042be739169981700a8a03c8ab5e4f3c35 | |
parent | b5ac538878addf85eb5436d4d25a086bb65b9b9c [diff] |
Add serde support for protobuf generated struct. (#35) * Add serde support for generated struct. * Add serde tests.
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::tracer::Tracer; use skywalking::reporter::grpc::GrpcReporter; use std::error::Error; use tokio::signal; async fn handle_request(tracer: Tracer) { let mut ctx = tracer.create_trace_context(); { // Generate an Entry Span when a request is received. // An Entry Span is generated only once per context. // Assign a variable name to guard the span not to be dropped immediately. let _span = ctx.create_entry_span("op1"); // Something... { // Generates an Exit Span when executing an RPC. let _span2 = ctx.create_exit_span("op2", "remote_peer"); // Something... // Auto close span2 when dropped. } // Auto close span when dropped. } // Auto report ctx when dropped. } #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { let reporter = GrpcReporter::connect("http://0.0.0.0:11800").await?; let tracer = Tracer::new("service", "instance", reporter); tokio::spawn(handle_request(tracer.clone())); // Start to report. let handle = tracer.reporting(async move { let _ = signal::ctrl_c().await; }); handle.await?; Ok(()) }
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.
The SkyWalking committer(PMC included) could follow this doc to release an official version.
Apache 2.0