Crates.io | skywalking_rust |
lib.rs | skywalking_rust |
version | 0.1.0 |
source | src |
created_at | 2022-02-17 12:00:23.699216 |
updated_at | 2022-02-17 12:00:23.699216 |
description | Apache SkyWalking Rust Agent |
homepage | https://skywalking.apache.org/ |
repository | https://github.com/apache/skywalking-rust |
max_upload_size | |
id | 534081 |
size | 162,010 |
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_rust::context::trace_context::TracingContext;
use skywalking_rust::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...
}
Apache 2.0